답안 #541117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541117 2022-03-22T09:10:58 Z Kiarat Bootfall (IZhO17_bootfall) C++14
100 / 100
382 ms 5696 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const ll mod = 1e9 + 7;
 
ll n;
ll a[250002];
ll sum = 0;
ll cnt[250002];
ll mp[250002];
 
void add(int x) {
	for (int i = sum; i >= 0; i--) {
		cnt[i + x] += cnt[i];
		if (cnt[i + x] >= mod) cnt[i + x] -= mod;
	}
	sum += x;
}
 
void sub(int x) {
	for (int i = 0; i <= sum; i++) {
		cnt[i + x] += (mod - cnt[i]);
		if (cnt[i + x] >= mod) cnt[i + x] -= mod;
	}
	sum -= x;
}
 
 
int main() {
 
    cin>>n;
    cnt[0] = 1;
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
        add(a[i]);
    }
 
    if(sum&1 || !cnt[sum/2])
    {
        cout<<"0\n";
        return 0;
    }
 
    for(ll i=1;i<=n;i++)
    {
        sub(a[i]);
        ll v = 2;
        if(sum & 1)
            v--;
        for(ll j=v; j<=sum; j+=2)
            if(cnt[(sum + j) / 2 - j])
                mp[j] ++;
                
        add(a[i]);
    }
    vector<ll> ans;
    for(ll i=1;i<=sum;i++)
        if(mp[i] == n)
            ans.push_back(i);
    cout<<ans.size()<<endl;
    for(auto it:ans)
        cout<<it<<" ";
    cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 4 ms 472 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 4 ms 468 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 468 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 4 ms 472 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 4 ms 468 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 468 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
37 Correct 13 ms 852 KB Output is correct
38 Correct 14 ms 888 KB Output is correct
39 Correct 48 ms 1280 KB Output is correct
40 Correct 28 ms 1108 KB Output is correct
41 Correct 60 ms 1408 KB Output is correct
42 Correct 24 ms 1044 KB Output is correct
43 Correct 45 ms 1560 KB Output is correct
44 Correct 45 ms 1572 KB Output is correct
45 Correct 51 ms 1572 KB Output is correct
46 Correct 27 ms 792 KB Output is correct
47 Correct 27 ms 1080 KB Output is correct
48 Correct 48 ms 1648 KB Output is correct
49 Correct 49 ms 1396 KB Output is correct
50 Correct 27 ms 1092 KB Output is correct
51 Correct 4 ms 468 KB Output is correct
52 Correct 62 ms 1916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 4 ms 472 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 4 ms 468 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 468 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
37 Correct 13 ms 852 KB Output is correct
38 Correct 14 ms 888 KB Output is correct
39 Correct 48 ms 1280 KB Output is correct
40 Correct 28 ms 1108 KB Output is correct
41 Correct 60 ms 1408 KB Output is correct
42 Correct 24 ms 1044 KB Output is correct
43 Correct 45 ms 1560 KB Output is correct
44 Correct 45 ms 1572 KB Output is correct
45 Correct 51 ms 1572 KB Output is correct
46 Correct 27 ms 792 KB Output is correct
47 Correct 27 ms 1080 KB Output is correct
48 Correct 48 ms 1648 KB Output is correct
49 Correct 49 ms 1396 KB Output is correct
50 Correct 27 ms 1092 KB Output is correct
51 Correct 4 ms 468 KB Output is correct
52 Correct 62 ms 1916 KB Output is correct
53 Correct 44 ms 1412 KB Output is correct
54 Correct 61 ms 1568 KB Output is correct
55 Correct 122 ms 2800 KB Output is correct
56 Correct 54 ms 1704 KB Output is correct
57 Correct 129 ms 2884 KB Output is correct
58 Correct 68 ms 1768 KB Output is correct
59 Correct 84 ms 2132 KB Output is correct
60 Correct 11 ms 724 KB Output is correct
61 Correct 98 ms 2280 KB Output is correct
62 Correct 96 ms 2560 KB Output is correct
63 Correct 106 ms 2644 KB Output is correct
64 Correct 101 ms 2660 KB Output is correct
65 Correct 48 ms 1060 KB Output is correct
66 Correct 49 ms 1216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 232 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 4 ms 472 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 4 ms 468 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 468 KB Output is correct
36 Correct 3 ms 340 KB Output is correct
37 Correct 13 ms 852 KB Output is correct
38 Correct 14 ms 888 KB Output is correct
39 Correct 48 ms 1280 KB Output is correct
40 Correct 28 ms 1108 KB Output is correct
41 Correct 60 ms 1408 KB Output is correct
42 Correct 24 ms 1044 KB Output is correct
43 Correct 45 ms 1560 KB Output is correct
44 Correct 45 ms 1572 KB Output is correct
45 Correct 51 ms 1572 KB Output is correct
46 Correct 27 ms 792 KB Output is correct
47 Correct 27 ms 1080 KB Output is correct
48 Correct 48 ms 1648 KB Output is correct
49 Correct 49 ms 1396 KB Output is correct
50 Correct 27 ms 1092 KB Output is correct
51 Correct 4 ms 468 KB Output is correct
52 Correct 62 ms 1916 KB Output is correct
53 Correct 44 ms 1412 KB Output is correct
54 Correct 61 ms 1568 KB Output is correct
55 Correct 122 ms 2800 KB Output is correct
56 Correct 54 ms 1704 KB Output is correct
57 Correct 129 ms 2884 KB Output is correct
58 Correct 68 ms 1768 KB Output is correct
59 Correct 84 ms 2132 KB Output is correct
60 Correct 11 ms 724 KB Output is correct
61 Correct 98 ms 2280 KB Output is correct
62 Correct 96 ms 2560 KB Output is correct
63 Correct 106 ms 2644 KB Output is correct
64 Correct 101 ms 2660 KB Output is correct
65 Correct 48 ms 1060 KB Output is correct
66 Correct 49 ms 1216 KB Output is correct
67 Correct 100 ms 2204 KB Output is correct
68 Correct 31 ms 1220 KB Output is correct
69 Correct 330 ms 5136 KB Output is correct
70 Correct 214 ms 3320 KB Output is correct
71 Correct 196 ms 3180 KB Output is correct
72 Correct 194 ms 2260 KB Output is correct
73 Correct 189 ms 2260 KB Output is correct
74 Correct 342 ms 5440 KB Output is correct
75 Correct 267 ms 4404 KB Output is correct
76 Correct 380 ms 5696 KB Output is correct
77 Correct 382 ms 5696 KB Output is correct