답안 #39847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
39847 2018-01-21T19:31:01 Z igzi Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 128064 KB
#include <bits/stdc++.h>
#define maxN 505
#define maxA 505

using namespace std;
bool b[maxN][maxN*maxA];
int n,i,j,s=0,a[maxN];
vector <int> v,ans;
bool moze(int x){
for(int i=0;i<n;i++){
    if((s+x-a[i])%2 || !b[i][(s+x-a[i])/2]) return false;
}
return true;
}

int main()
{
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        s+=a[i];
    }
    for(j=0;j<=n;j++){
    for(i=1;i<=250000;i++){
        b[j][i]=false;
    }}
    for(j=0;j<=n;j++){
    b[j][0]=false;
    v.push_back(0);
    for(i=0;i<n;i++){
        int t,k;
        if(i==j) continue;
        t=v.size();
        for(k=0;k<t;k++){
            if(!b[j][a[i]+v[k]]){
                b[j][a[i]+v[k]]=true;
                v.push_back(a[i]+v[k]);
            }
        }
    }
    v.clear();
    }
    if(s%2 || !b[n][s/2]) cout<<0<<endl;
    else{
        for(i=0;i<=250000;i++){
            if(moze(i)) ans.push_back(i);
        }
        cout<<ans.size()<<endl;
        for(i=0;i<ans.size();i++){
            cout<<ans[i]<<" ";
        }
    }
    return 0;
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:49:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(i=0;i<ans.size();i++){
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 127792 KB Output is correct
2 Correct 1 ms 127792 KB Output is correct
3 Correct 0 ms 127792 KB Output is correct
4 Correct 1 ms 127792 KB Output is correct
5 Correct 4 ms 127792 KB Output is correct
6 Correct 4 ms 127792 KB Output is correct
7 Correct 3 ms 127792 KB Output is correct
8 Correct 0 ms 127792 KB Output is correct
9 Correct 4 ms 127792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 127792 KB Output is correct
2 Correct 1 ms 127792 KB Output is correct
3 Correct 0 ms 127792 KB Output is correct
4 Correct 1 ms 127792 KB Output is correct
5 Correct 4 ms 127792 KB Output is correct
6 Correct 4 ms 127792 KB Output is correct
7 Correct 3 ms 127792 KB Output is correct
8 Correct 0 ms 127792 KB Output is correct
9 Correct 4 ms 127792 KB Output is correct
10 Correct 3 ms 127792 KB Output is correct
11 Correct 6 ms 127792 KB Output is correct
12 Correct 9 ms 127792 KB Output is correct
13 Correct 5 ms 127792 KB Output is correct
14 Correct 11 ms 127792 KB Output is correct
15 Correct 4 ms 127792 KB Output is correct
16 Correct 6 ms 127792 KB Output is correct
17 Correct 6 ms 127792 KB Output is correct
18 Correct 0 ms 127792 KB Output is correct
19 Correct 5 ms 127792 KB Output is correct
20 Correct 3 ms 127792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 127792 KB Output is correct
2 Correct 1 ms 127792 KB Output is correct
3 Correct 0 ms 127792 KB Output is correct
4 Correct 1 ms 127792 KB Output is correct
5 Correct 4 ms 127792 KB Output is correct
6 Correct 4 ms 127792 KB Output is correct
7 Correct 3 ms 127792 KB Output is correct
8 Correct 0 ms 127792 KB Output is correct
9 Correct 4 ms 127792 KB Output is correct
10 Correct 3 ms 127792 KB Output is correct
11 Correct 6 ms 127792 KB Output is correct
12 Correct 9 ms 127792 KB Output is correct
13 Correct 5 ms 127792 KB Output is correct
14 Correct 11 ms 127792 KB Output is correct
15 Correct 4 ms 127792 KB Output is correct
16 Correct 6 ms 127792 KB Output is correct
17 Correct 6 ms 127792 KB Output is correct
18 Correct 0 ms 127792 KB Output is correct
19 Correct 5 ms 127792 KB Output is correct
20 Correct 3 ms 127792 KB Output is correct
21 Correct 13 ms 127792 KB Output is correct
22 Correct 37 ms 127792 KB Output is correct
23 Correct 14 ms 127792 KB Output is correct
24 Correct 38 ms 127932 KB Output is correct
25 Correct 61 ms 127932 KB Output is correct
26 Correct 57 ms 127932 KB Output is correct
27 Correct 47 ms 127792 KB Output is correct
28 Correct 38 ms 127792 KB Output is correct
29 Correct 49 ms 127932 KB Output is correct
30 Correct 47 ms 127932 KB Output is correct
31 Correct 67 ms 127932 KB Output is correct
32 Correct 59 ms 127932 KB Output is correct
33 Correct 12 ms 127792 KB Output is correct
34 Correct 19 ms 127792 KB Output is correct
35 Correct 35 ms 127792 KB Output is correct
36 Correct 49 ms 127932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 127792 KB Output is correct
2 Correct 1 ms 127792 KB Output is correct
3 Correct 0 ms 127792 KB Output is correct
4 Correct 1 ms 127792 KB Output is correct
5 Correct 4 ms 127792 KB Output is correct
6 Correct 4 ms 127792 KB Output is correct
7 Correct 3 ms 127792 KB Output is correct
8 Correct 0 ms 127792 KB Output is correct
9 Correct 4 ms 127792 KB Output is correct
10 Correct 3 ms 127792 KB Output is correct
11 Correct 6 ms 127792 KB Output is correct
12 Correct 9 ms 127792 KB Output is correct
13 Correct 5 ms 127792 KB Output is correct
14 Correct 11 ms 127792 KB Output is correct
15 Correct 4 ms 127792 KB Output is correct
16 Correct 6 ms 127792 KB Output is correct
17 Correct 6 ms 127792 KB Output is correct
18 Correct 0 ms 127792 KB Output is correct
19 Correct 5 ms 127792 KB Output is correct
20 Correct 3 ms 127792 KB Output is correct
21 Correct 13 ms 127792 KB Output is correct
22 Correct 37 ms 127792 KB Output is correct
23 Correct 14 ms 127792 KB Output is correct
24 Correct 38 ms 127932 KB Output is correct
25 Correct 61 ms 127932 KB Output is correct
26 Correct 57 ms 127932 KB Output is correct
27 Correct 47 ms 127792 KB Output is correct
28 Correct 38 ms 127792 KB Output is correct
29 Correct 49 ms 127932 KB Output is correct
30 Correct 47 ms 127932 KB Output is correct
31 Correct 67 ms 127932 KB Output is correct
32 Correct 59 ms 127932 KB Output is correct
33 Correct 12 ms 127792 KB Output is correct
34 Correct 19 ms 127792 KB Output is correct
35 Correct 35 ms 127792 KB Output is correct
36 Correct 49 ms 127932 KB Output is correct
37 Correct 612 ms 128064 KB Output is correct
38 Correct 669 ms 128064 KB Output is correct
39 Correct 45 ms 127792 KB Output is correct
40 Execution timed out 1000 ms 128064 KB Execution timed out
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 127792 KB Output is correct
2 Correct 1 ms 127792 KB Output is correct
3 Correct 0 ms 127792 KB Output is correct
4 Correct 1 ms 127792 KB Output is correct
5 Correct 4 ms 127792 KB Output is correct
6 Correct 4 ms 127792 KB Output is correct
7 Correct 3 ms 127792 KB Output is correct
8 Correct 0 ms 127792 KB Output is correct
9 Correct 4 ms 127792 KB Output is correct
10 Correct 3 ms 127792 KB Output is correct
11 Correct 6 ms 127792 KB Output is correct
12 Correct 9 ms 127792 KB Output is correct
13 Correct 5 ms 127792 KB Output is correct
14 Correct 11 ms 127792 KB Output is correct
15 Correct 4 ms 127792 KB Output is correct
16 Correct 6 ms 127792 KB Output is correct
17 Correct 6 ms 127792 KB Output is correct
18 Correct 0 ms 127792 KB Output is correct
19 Correct 5 ms 127792 KB Output is correct
20 Correct 3 ms 127792 KB Output is correct
21 Correct 13 ms 127792 KB Output is correct
22 Correct 37 ms 127792 KB Output is correct
23 Correct 14 ms 127792 KB Output is correct
24 Correct 38 ms 127932 KB Output is correct
25 Correct 61 ms 127932 KB Output is correct
26 Correct 57 ms 127932 KB Output is correct
27 Correct 47 ms 127792 KB Output is correct
28 Correct 38 ms 127792 KB Output is correct
29 Correct 49 ms 127932 KB Output is correct
30 Correct 47 ms 127932 KB Output is correct
31 Correct 67 ms 127932 KB Output is correct
32 Correct 59 ms 127932 KB Output is correct
33 Correct 12 ms 127792 KB Output is correct
34 Correct 19 ms 127792 KB Output is correct
35 Correct 35 ms 127792 KB Output is correct
36 Correct 49 ms 127932 KB Output is correct
37 Correct 612 ms 128064 KB Output is correct
38 Correct 669 ms 128064 KB Output is correct
39 Correct 45 ms 127792 KB Output is correct
40 Execution timed out 1000 ms 128064 KB Execution timed out
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 127792 KB Output is correct
2 Correct 1 ms 127792 KB Output is correct
3 Correct 0 ms 127792 KB Output is correct
4 Correct 1 ms 127792 KB Output is correct
5 Correct 4 ms 127792 KB Output is correct
6 Correct 4 ms 127792 KB Output is correct
7 Correct 3 ms 127792 KB Output is correct
8 Correct 0 ms 127792 KB Output is correct
9 Correct 4 ms 127792 KB Output is correct
10 Correct 3 ms 127792 KB Output is correct
11 Correct 6 ms 127792 KB Output is correct
12 Correct 9 ms 127792 KB Output is correct
13 Correct 5 ms 127792 KB Output is correct
14 Correct 11 ms 127792 KB Output is correct
15 Correct 4 ms 127792 KB Output is correct
16 Correct 6 ms 127792 KB Output is correct
17 Correct 6 ms 127792 KB Output is correct
18 Correct 0 ms 127792 KB Output is correct
19 Correct 5 ms 127792 KB Output is correct
20 Correct 3 ms 127792 KB Output is correct
21 Correct 13 ms 127792 KB Output is correct
22 Correct 37 ms 127792 KB Output is correct
23 Correct 14 ms 127792 KB Output is correct
24 Correct 38 ms 127932 KB Output is correct
25 Correct 61 ms 127932 KB Output is correct
26 Correct 57 ms 127932 KB Output is correct
27 Correct 47 ms 127792 KB Output is correct
28 Correct 38 ms 127792 KB Output is correct
29 Correct 49 ms 127932 KB Output is correct
30 Correct 47 ms 127932 KB Output is correct
31 Correct 67 ms 127932 KB Output is correct
32 Correct 59 ms 127932 KB Output is correct
33 Correct 12 ms 127792 KB Output is correct
34 Correct 19 ms 127792 KB Output is correct
35 Correct 35 ms 127792 KB Output is correct
36 Correct 49 ms 127932 KB Output is correct
37 Correct 612 ms 128064 KB Output is correct
38 Correct 669 ms 128064 KB Output is correct
39 Correct 45 ms 127792 KB Output is correct
40 Execution timed out 1000 ms 128064 KB Execution timed out
41 Halted 0 ms 0 KB -