Submission #202088

# Submission time Handle Problem Language Result Execution time Memory
202088 2020-02-13T18:55:41 Z algorithm16 Kas (COCI17_kas) C++14
50 / 100
1034 ms 171748 KB
#include<iostream>
#include<algorithm>
using namespace std;
int dp[505][200005],arr[505],sum,n;
int rek(int ind,int x,int y) {
     if(ind==n) {
          if(x==y) return x;
          return -1e9;
     }
     if(dp[ind][int(x-y+1e5)]!=0) return dp[ind][int(x-y+1e5)];
     int ret=max(rek(ind+1,x,y),max(rek(ind+1,x+arr[ind],y),rek(ind+1,x,y+arr[ind])));
     dp[ind][int(x-y+1e5)]=ret;
     return ret;
}
int main()
{
     cin >> n;
     for(int i=0;i<n;i++) {
          cin >> arr[i];
          sum+=arr[i];
     }
     int sol=rek(0,0,0);
     cout << sum-sol;
     return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 636 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 760 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 31868 KB Output is correct
2 Correct 60 ms 10616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 210 ms 35644 KB Output is correct
2 Incorrect 237 ms 44152 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 462 ms 79328 KB Output is correct
2 Correct 1034 ms 171748 KB Output is correct