SHARE
TWEET

Untitled

a guest Jan 20th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3. int d[4], d1[4];
  4. int main()
  5. {
  6.     int n, s[3];
  7.     cin >> n;
  8.     for (int i = 0; i < n; i++)
  9.     {
  10.         int x, y, z;
  11.         cin >> x >> y >> z;
  12.         for (int j = 0; j < 4; j++)
  13.             d1[j] = 0;
  14.         s[0] = x+y;
  15.         s[1] = x+z;
  16.         s[2] = y+z;
  17.        
  18.         for (int j = 0; j < 3; j++)
  19.             for (int u = 0; u < 4; u++)
  20.                 if ((!i || d[u]) && d[u] + s[j] > d1[(dp[u] + s[j])%4])
  21.                     d1[(d[u] + s[j])%4] = dp[u] + s[j];
  22.                    
  23.         for (int j = 0; j < 4; j++)
  24.             d[j] = d1[j];
  25.     }
  26.    
  27.     cout << d[0];
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top