# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
537600 | dantoh000 | Kpart (eJOI21_kpart) | C++14 | 1757 ms | 852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
map<int,int> ct;
int tc;
int n;
int can[1005];
int a[1005];
int lst[100005];
int p[1005];
int main(){
scanf("%d",&tc);
while (tc--){
scanf("%d",&n);
for (int i = 1; i <= n; i++){
scanf("%d",&a[i]);
p[i] = a[i] + p[i-1];
}
lst[0] = 0;
for (int i = 1; i <= n; i++) can[i] = 1;
for (int i = 1; i <= 100000; i++) lst[i] = -1;
for (int i = 1; i <= n; i++){
for (int j = 100000-a[i]; j >= 0; j--){
if (lst[j] == -1) continue;
lst[j+a[i]] = max(lst[j], lst[j+a[i]]);
}
for (int k = 1; k <= i; k++){
int s = p[i]-p[i-k];
if (s % 2 == 1 || lst[s/2] < i-k+1){
can[k] = false;
}
}
lst[0] = i;
}
int ct = 0;
for (int i = 0; i <= n; i++) {
ct += can[i];
}
printf("%d ",ct);
for (int i = 0; i <= n; i++) {
if (can[i]) printf("%d ",i);
}
printf("\n");
}
}
컴파일 시 표준 에러 (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... |