Submission #994029

# Submission time Handle Problem Language Result Execution time Memory
994029 2024-06-07T03:55:26 Z vjudge1 Kas (COCI17_kas) C++17
70 / 100
104 ms 6224 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
int const N=2005;
int const mod=1e9+7;

bool have[N][N];

void solve(){
	int n;
	cin>>n;
	have[0][0]=1;
	int sm=0;
	for(int e=0;e<n;e++){
		int c;
		cin>>c;
		sm+=c;
		for(int i=500;i>=0;i--)
			for(int j=500;j>=0;j--)
				if(have[i][j]){
					have[i+c][j]=1;
					have[i][j+c]=1;
				}
	}
	// cout<<sm<<endl;
	for(int i=500;i>=0;i--)
		if(have[i][i]){
			cout<<sm-i<<endl;
			return;
		}
}

int main(){
	int t=1;
	// cin>>t;
	while(t--)
		solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 2 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 2 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1372 KB Output is correct
2 Correct 4 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1112 KB Output is correct
2 Correct 4 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1112 KB Output is correct
2 Correct 8 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1116 KB Output is correct
2 Correct 11 ms 1732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 36 ms 4008 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 54 ms 2648 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 6224 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -