# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1057378 |
2024-08-13T18:29:55 Z |
oscar1f |
Kpart (eJOI21_kpart) |
C++17 |
|
4 ms |
604 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int TAILLE_MAX=1000+5,SOMME_MAX=100*1000+5;
int nbTest,nbVal;
int somCour[TAILLE_MAX],val[TAILLE_MAX],pb[TAILLE_MAX],premUti[TAILLE_MAX];
vector<int> rep;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int obj;
cin>>nbTest;
for (int itest=0;itest<nbTest;itest++) {
cin>>nbVal;
for (int i=1;i<=nbVal;i++) {
pb[i]=0;
}
for (int i=1;i<=nbVal;i++) {
cin>>val[i];
somCour[i]=somCour[i-1]+val[i];
}
premUti[0]=nbVal;
for (int i=1;i<=somCour[nbVal]/2;i++) {
premUti[i]=0;
}
for (int i=1;i<=nbVal;i++) {
for (int j=val[i];j<=somCour[nbVal]/2;j++) {
premUti[j]=max(premUti[j],min(premUti[j-val[i]],i));
}
for (int j=1;j<=i;j++) {
obj=somCour[i]-somCour[j-1];
if (obj%2==1 or premUti[obj/2]<j) {
pb[i-j+1]=1;
}
}
}
rep.clear();
for (int i=1;i<=nbVal;i++) {
if (pb[i]==0) {
rep.push_back(i);
}
}
cout<<rep.size()<<" ";
for (int i:rep) {
cout<<i<<" ";
}
cout<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |