Submission #839216

# Submission time Handle Problem Language Result Execution time Memory
839216 2023-08-29T08:07:17 Z teo_thrash Kas (COCI17_kas) C++14
0 / 100
32 ms 596 KB
#include<bits/stdc++.h>
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int maxn=1e6+3;
const int mod=1e9+7;

int n;
ll a[503];
ll dp[maxn], sum=0;

int main(){

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

cin>>n;
for(int i=0; i<n; i++){
    cin>>a[i];
    sum+=a[i];
}

sort(a, a+n, greater<int>() );

dp[a[0]]=a[0];

for(int i=1; i<n; i++){
    for(int j=0; j<=sum-a[i]; j++){
        if(dp[j+a[i]]!=0){
            dp[j]=max(dp[j], dp[j+a[i]]+a[i]);
        }
    }
    dp[a[i]]=max(dp[a[i]], a[i]);
}
cout<<sum - dp[0]/2<<endl;

return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -