답안 #85409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
85409 2018-11-19T19:46:26 Z ToadDaveski Bootfall (IZhO17_bootfall) C++14
100 / 100
477 ms 6532 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[501],dp[501*501],sum=0,isA[501*501];
vector <ll> answer;
void add(ll x)
{
    sum+=x;
    for(ll i=500*500;i>=x;i--)
        dp[i]+=dp[i-x];
}
void del(ll x)
{
    sum-=x;
    for(ll i=x;i<=500*500;i++)
        dp[i]-=dp[i-x];
}
int main()
{
    ll n,m,i,j;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    dp[0]=1;
    for(i=1;i<=n;i++)
        add(a[i]);
    if (sum%2 || !dp[sum/2])
    {
        cout<<0;
        return 0;
    }
    for(i=1;i<=n;i++)
    {
        del(a[i]);
        for(j=1;j<=500*500;j++)
            if ((sum+j)%2 ||  !dp[(sum+j)/2])
            isA[j]=1;
        add(a[i]);
    }
    for(i=1;i<=500*500;i++)
        if (!isA[i]) answer.push_back(i);
    cout<<answer.size()<<endl;
    for(ll toad: answer)
        cout<<toad<<" ";
    return 0;
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:20:10: warning: unused variable 'm' [-Wunused-variable]
     ll n,m,i,j;
          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4216 KB Output is correct
2 Correct 12 ms 4224 KB Output is correct
3 Correct 5 ms 4224 KB Output is correct
4 Correct 10 ms 4320 KB Output is correct
5 Correct 17 ms 4484 KB Output is correct
6 Correct 13 ms 4484 KB Output is correct
7 Correct 12 ms 4484 KB Output is correct
8 Correct 17 ms 4488 KB Output is correct
9 Correct 16 ms 4492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4216 KB Output is correct
2 Correct 12 ms 4224 KB Output is correct
3 Correct 5 ms 4224 KB Output is correct
4 Correct 10 ms 4320 KB Output is correct
5 Correct 17 ms 4484 KB Output is correct
6 Correct 13 ms 4484 KB Output is correct
7 Correct 12 ms 4484 KB Output is correct
8 Correct 17 ms 4488 KB Output is correct
9 Correct 16 ms 4492 KB Output is correct
10 Correct 32 ms 4624 KB Output is correct
11 Correct 34 ms 4624 KB Output is correct
12 Correct 33 ms 4624 KB Output is correct
13 Correct 29 ms 4624 KB Output is correct
14 Correct 30 ms 4624 KB Output is correct
15 Correct 32 ms 4624 KB Output is correct
16 Correct 55 ms 4624 KB Output is correct
17 Correct 23 ms 4624 KB Output is correct
18 Correct 27 ms 4624 KB Output is correct
19 Correct 30 ms 4624 KB Output is correct
20 Correct 38 ms 4624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4216 KB Output is correct
2 Correct 12 ms 4224 KB Output is correct
3 Correct 5 ms 4224 KB Output is correct
4 Correct 10 ms 4320 KB Output is correct
5 Correct 17 ms 4484 KB Output is correct
6 Correct 13 ms 4484 KB Output is correct
7 Correct 12 ms 4484 KB Output is correct
8 Correct 17 ms 4488 KB Output is correct
9 Correct 16 ms 4492 KB Output is correct
10 Correct 32 ms 4624 KB Output is correct
11 Correct 34 ms 4624 KB Output is correct
12 Correct 33 ms 4624 KB Output is correct
13 Correct 29 ms 4624 KB Output is correct
14 Correct 30 ms 4624 KB Output is correct
15 Correct 32 ms 4624 KB Output is correct
16 Correct 55 ms 4624 KB Output is correct
17 Correct 23 ms 4624 KB Output is correct
18 Correct 27 ms 4624 KB Output is correct
19 Correct 30 ms 4624 KB Output is correct
20 Correct 38 ms 4624 KB Output is correct
21 Correct 62 ms 4624 KB Output is correct
22 Correct 94 ms 4632 KB Output is correct
23 Correct 53 ms 4660 KB Output is correct
24 Correct 94 ms 4720 KB Output is correct
25 Correct 120 ms 4720 KB Output is correct
26 Correct 93 ms 4724 KB Output is correct
27 Correct 93 ms 4724 KB Output is correct
28 Correct 94 ms 4724 KB Output is correct
29 Correct 93 ms 4724 KB Output is correct
30 Correct 92 ms 4724 KB Output is correct
31 Correct 118 ms 4776 KB Output is correct
32 Correct 95 ms 4880 KB Output is correct
33 Correct 92 ms 4880 KB Output is correct
34 Correct 95 ms 4880 KB Output is correct
35 Correct 112 ms 4880 KB Output is correct
36 Correct 96 ms 4880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4216 KB Output is correct
2 Correct 12 ms 4224 KB Output is correct
3 Correct 5 ms 4224 KB Output is correct
4 Correct 10 ms 4320 KB Output is correct
5 Correct 17 ms 4484 KB Output is correct
6 Correct 13 ms 4484 KB Output is correct
7 Correct 12 ms 4484 KB Output is correct
8 Correct 17 ms 4488 KB Output is correct
9 Correct 16 ms 4492 KB Output is correct
10 Correct 32 ms 4624 KB Output is correct
11 Correct 34 ms 4624 KB Output is correct
12 Correct 33 ms 4624 KB Output is correct
13 Correct 29 ms 4624 KB Output is correct
14 Correct 30 ms 4624 KB Output is correct
15 Correct 32 ms 4624 KB Output is correct
16 Correct 55 ms 4624 KB Output is correct
17 Correct 23 ms 4624 KB Output is correct
18 Correct 27 ms 4624 KB Output is correct
19 Correct 30 ms 4624 KB Output is correct
20 Correct 38 ms 4624 KB Output is correct
21 Correct 62 ms 4624 KB Output is correct
22 Correct 94 ms 4632 KB Output is correct
23 Correct 53 ms 4660 KB Output is correct
24 Correct 94 ms 4720 KB Output is correct
25 Correct 120 ms 4720 KB Output is correct
26 Correct 93 ms 4724 KB Output is correct
27 Correct 93 ms 4724 KB Output is correct
28 Correct 94 ms 4724 KB Output is correct
29 Correct 93 ms 4724 KB Output is correct
30 Correct 92 ms 4724 KB Output is correct
31 Correct 118 ms 4776 KB Output is correct
32 Correct 95 ms 4880 KB Output is correct
33 Correct 92 ms 4880 KB Output is correct
34 Correct 95 ms 4880 KB Output is correct
35 Correct 112 ms 4880 KB Output is correct
36 Correct 96 ms 4880 KB Output is correct
37 Correct 186 ms 5044 KB Output is correct
38 Correct 198 ms 5104 KB Output is correct
39 Correct 236 ms 5104 KB Output is correct
40 Correct 262 ms 5200 KB Output is correct
41 Correct 238 ms 5200 KB Output is correct
42 Correct 243 ms 5200 KB Output is correct
43 Correct 254 ms 5208 KB Output is correct
44 Correct 226 ms 5208 KB Output is correct
45 Correct 227 ms 5208 KB Output is correct
46 Correct 248 ms 5208 KB Output is correct
47 Correct 223 ms 5208 KB Output is correct
48 Correct 227 ms 5208 KB Output is correct
49 Correct 237 ms 5208 KB Output is correct
50 Correct 232 ms 5208 KB Output is correct
51 Correct 57 ms 5208 KB Output is correct
52 Correct 259 ms 5328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4216 KB Output is correct
2 Correct 12 ms 4224 KB Output is correct
3 Correct 5 ms 4224 KB Output is correct
4 Correct 10 ms 4320 KB Output is correct
5 Correct 17 ms 4484 KB Output is correct
6 Correct 13 ms 4484 KB Output is correct
7 Correct 12 ms 4484 KB Output is correct
8 Correct 17 ms 4488 KB Output is correct
9 Correct 16 ms 4492 KB Output is correct
10 Correct 32 ms 4624 KB Output is correct
11 Correct 34 ms 4624 KB Output is correct
12 Correct 33 ms 4624 KB Output is correct
13 Correct 29 ms 4624 KB Output is correct
14 Correct 30 ms 4624 KB Output is correct
15 Correct 32 ms 4624 KB Output is correct
16 Correct 55 ms 4624 KB Output is correct
17 Correct 23 ms 4624 KB Output is correct
18 Correct 27 ms 4624 KB Output is correct
19 Correct 30 ms 4624 KB Output is correct
20 Correct 38 ms 4624 KB Output is correct
21 Correct 62 ms 4624 KB Output is correct
22 Correct 94 ms 4632 KB Output is correct
23 Correct 53 ms 4660 KB Output is correct
24 Correct 94 ms 4720 KB Output is correct
25 Correct 120 ms 4720 KB Output is correct
26 Correct 93 ms 4724 KB Output is correct
27 Correct 93 ms 4724 KB Output is correct
28 Correct 94 ms 4724 KB Output is correct
29 Correct 93 ms 4724 KB Output is correct
30 Correct 92 ms 4724 KB Output is correct
31 Correct 118 ms 4776 KB Output is correct
32 Correct 95 ms 4880 KB Output is correct
33 Correct 92 ms 4880 KB Output is correct
34 Correct 95 ms 4880 KB Output is correct
35 Correct 112 ms 4880 KB Output is correct
36 Correct 96 ms 4880 KB Output is correct
37 Correct 186 ms 5044 KB Output is correct
38 Correct 198 ms 5104 KB Output is correct
39 Correct 236 ms 5104 KB Output is correct
40 Correct 262 ms 5200 KB Output is correct
41 Correct 238 ms 5200 KB Output is correct
42 Correct 243 ms 5200 KB Output is correct
43 Correct 254 ms 5208 KB Output is correct
44 Correct 226 ms 5208 KB Output is correct
45 Correct 227 ms 5208 KB Output is correct
46 Correct 248 ms 5208 KB Output is correct
47 Correct 223 ms 5208 KB Output is correct
48 Correct 227 ms 5208 KB Output is correct
49 Correct 237 ms 5208 KB Output is correct
50 Correct 232 ms 5208 KB Output is correct
51 Correct 57 ms 5208 KB Output is correct
52 Correct 259 ms 5328 KB Output is correct
53 Correct 286 ms 5328 KB Output is correct
54 Correct 323 ms 5328 KB Output is correct
55 Correct 325 ms 5572 KB Output is correct
56 Correct 282 ms 5572 KB Output is correct
57 Correct 320 ms 5584 KB Output is correct
58 Correct 316 ms 5584 KB Output is correct
59 Correct 327 ms 5584 KB Output is correct
60 Correct 118 ms 5584 KB Output is correct
61 Correct 354 ms 5584 KB Output is correct
62 Correct 304 ms 5600 KB Output is correct
63 Correct 294 ms 5612 KB Output is correct
64 Correct 281 ms 5612 KB Output is correct
65 Correct 311 ms 5612 KB Output is correct
66 Correct 299 ms 5612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 4216 KB Output is correct
2 Correct 12 ms 4224 KB Output is correct
3 Correct 5 ms 4224 KB Output is correct
4 Correct 10 ms 4320 KB Output is correct
5 Correct 17 ms 4484 KB Output is correct
6 Correct 13 ms 4484 KB Output is correct
7 Correct 12 ms 4484 KB Output is correct
8 Correct 17 ms 4488 KB Output is correct
9 Correct 16 ms 4492 KB Output is correct
10 Correct 32 ms 4624 KB Output is correct
11 Correct 34 ms 4624 KB Output is correct
12 Correct 33 ms 4624 KB Output is correct
13 Correct 29 ms 4624 KB Output is correct
14 Correct 30 ms 4624 KB Output is correct
15 Correct 32 ms 4624 KB Output is correct
16 Correct 55 ms 4624 KB Output is correct
17 Correct 23 ms 4624 KB Output is correct
18 Correct 27 ms 4624 KB Output is correct
19 Correct 30 ms 4624 KB Output is correct
20 Correct 38 ms 4624 KB Output is correct
21 Correct 62 ms 4624 KB Output is correct
22 Correct 94 ms 4632 KB Output is correct
23 Correct 53 ms 4660 KB Output is correct
24 Correct 94 ms 4720 KB Output is correct
25 Correct 120 ms 4720 KB Output is correct
26 Correct 93 ms 4724 KB Output is correct
27 Correct 93 ms 4724 KB Output is correct
28 Correct 94 ms 4724 KB Output is correct
29 Correct 93 ms 4724 KB Output is correct
30 Correct 92 ms 4724 KB Output is correct
31 Correct 118 ms 4776 KB Output is correct
32 Correct 95 ms 4880 KB Output is correct
33 Correct 92 ms 4880 KB Output is correct
34 Correct 95 ms 4880 KB Output is correct
35 Correct 112 ms 4880 KB Output is correct
36 Correct 96 ms 4880 KB Output is correct
37 Correct 186 ms 5044 KB Output is correct
38 Correct 198 ms 5104 KB Output is correct
39 Correct 236 ms 5104 KB Output is correct
40 Correct 262 ms 5200 KB Output is correct
41 Correct 238 ms 5200 KB Output is correct
42 Correct 243 ms 5200 KB Output is correct
43 Correct 254 ms 5208 KB Output is correct
44 Correct 226 ms 5208 KB Output is correct
45 Correct 227 ms 5208 KB Output is correct
46 Correct 248 ms 5208 KB Output is correct
47 Correct 223 ms 5208 KB Output is correct
48 Correct 227 ms 5208 KB Output is correct
49 Correct 237 ms 5208 KB Output is correct
50 Correct 232 ms 5208 KB Output is correct
51 Correct 57 ms 5208 KB Output is correct
52 Correct 259 ms 5328 KB Output is correct
53 Correct 286 ms 5328 KB Output is correct
54 Correct 323 ms 5328 KB Output is correct
55 Correct 325 ms 5572 KB Output is correct
56 Correct 282 ms 5572 KB Output is correct
57 Correct 320 ms 5584 KB Output is correct
58 Correct 316 ms 5584 KB Output is correct
59 Correct 327 ms 5584 KB Output is correct
60 Correct 118 ms 5584 KB Output is correct
61 Correct 354 ms 5584 KB Output is correct
62 Correct 304 ms 5600 KB Output is correct
63 Correct 294 ms 5612 KB Output is correct
64 Correct 281 ms 5612 KB Output is correct
65 Correct 311 ms 5612 KB Output is correct
66 Correct 299 ms 5612 KB Output is correct
67 Correct 377 ms 5612 KB Output is correct
68 Correct 104 ms 5612 KB Output is correct
69 Correct 449 ms 6356 KB Output is correct
70 Correct 455 ms 6356 KB Output is correct
71 Correct 451 ms 6356 KB Output is correct
72 Correct 441 ms 6356 KB Output is correct
73 Correct 439 ms 6356 KB Output is correct
74 Correct 477 ms 6508 KB Output is correct
75 Correct 469 ms 6508 KB Output is correct
76 Correct 471 ms 6508 KB Output is correct
77 Correct 459 ms 6532 KB Output is correct