Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int d[4], d1[4];
- int main()
- {
- int n, s[3];
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- int x, y, z;
- cin >> x >> y >> z;
- for (int j = 0; j < 4; j++)
- d1[j] = 0;
- s[0] = x+y;
- s[1] = x+z;
- s[2] = y+z;
- for (int j = 0; j < 3; j++)
- for (int u = 0; u < 4; u++)
- if ((!i || d[u]) && d[u] + s[j] > d1[(dp[u] + s[j])%4])
- d1[(d[u] + s[j])%4] = dp[u] + s[j];
- for (int j = 0; j < 4; j++)
- d[j] = d1[j];
- }
- cout << d[0];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement