| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 635761 | deme_bz | Kpart (eJOI21_kpart) | C++14 | 1545 ms | 197316 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define eb emplace_back
#define sz(x) (int)x.size()
using namespace std;
const int N=1e3+1,MAX=5e4;
vector <int> pre(N+1,0);
vector < vector<int> > ind(N+1,vector <int> (MAX+1, 0));
void test_case(){
int n;
cin >> n;
for(int i=1;i<=n;i++){
int a;
cin >> a;
pre[i]=pre[i-1]+a;
for(int j=0;j<=MAX;j++){
ind[i][j]=ind[i-1][j];
if(j==a){
ind[i][j]=i;
}
else
if(j>a){
ind[i][j]=max(ind[i][j],ind[i-1][j-a]);
}
}
}
vector <int> ans;
for(int k=1;k<=n;k++){
bool B=true;
for(int l=1;l<=n-k+1;l++){
int r=l+k-1;
int sum=pre[r]-pre[l-1];
if(sum%2!=0 || ind[r][sum/2]<l){
B=false;
break;
}
}
if(B){
ans.pb(k);
}
}
//cout << endl;
cout << ans.size() << " ";
for(auto to : ans){
cout << to << " ";
}
cout << endl;
}
int main(){
int T = 1;
cin >> T;
while(T--){
test_case();
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
