# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1107475 |
2024-11-01T09:24:43 Z |
vjudge1 |
Kpart (eJOI21_kpart) |
C++17 |
|
121 ms |
336 KB |
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
using namespace std;
const int N=2e5+5;
const int inf=1e9;
const int mod=1e9+7;
const int N1=1e6+1;
vector<int>v;
vector<int>v1;
struct edge{
int v,time;
};
int dp[1001];
signed main(){
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
v.push_back(0);
for(int i=0;i<n;i++){
int x;
cin>>x;
v.push_back(x);
}
for(int l=1;l<=n;l++){
int sum=0;
for(int r=l;r<=n;r++){
sum+=v[r];
v1.push_back(v[r]);
if(dp[r-l+1]==1){
continue;
}
if(r-l+1>1){
if(sum%2==1){
dp[r-l+1]=1;
continue;
}
int cnt=sum/2;
sort(v1.begin(),v1.end());
for(int i=v1.size()-1;i>=0;i--){
if(cnt>=v1[i]){
cnt-=v1[i];
}
}
if(cnt!=0){
dp[r-l+1]=1;
}
}
}
v1.clear();
}
int ans=0;
for(int i=2;i<=n;i++){
if(dp[i]==0){
ans++;
}
}
cout<<ans<<" ";
for(int i=2;i<=n;i++){
if(dp[i]==0){
cout<<i<<" ";
}
dp[i]=0;
}
cout<<"\n";
v.clear();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
121 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |