CSES - IZhO 2017, day 1 - Results
Submission details
Task:Bootfall
Sender:jarvenp
Submission time:2019-02-02 18:04:51 +0200
Language:C++
Status:READY
Result:6
Feedback
groupverdictscore
#1ACCEPTED6
#20
#30
#40
#50
#60
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1details
#2ACCEPTED0.01 s1details
#3ACCEPTED0.01 s1details
#4ACCEPTED0.03 s1details
#5ACCEPTED0.03 s1details
#6ACCEPTED0.02 s1details
#7ACCEPTED0.02 s1details
#8ACCEPTED0.01 s1details
#9ACCEPTED0.03 s1details
#10--2details
#11--2details
#12--2details
#13--2details
#14--2details
#15--2details
#16--2details
#17ACCEPTED0.06 s2details
#18--2details
#19--2details
#20--2details
#21--3details
#220.01 s3details
#230.02 s3details
#240.02 s3details
#250.02 s3details
#260.02 s3details
#270.03 s3details
#280.01 s3details
#290.02 s3details
#300.02 s3details
#310.02 s3details
#32--3details
#330.02 s3details
#340.01 s3details
#350.01 s3details
#360.28 s3details
#370.02 s4details
#380.02 s4details
#390.01 s4details
#400.02 s4details
#410.02 s4details
#420.02 s4details
#430.02 s4details
#440.02 s4details
#450.01 s4details
#460.01 s4details
#470.02 s4details
#480.02 s4details
#490.02 s4details
#500.01 s4details
#510.01 s4details
#520.01 s4details
#530.03 s5details
#540.01 s5details
#550.02 s5details
#560.01 s5details
#570.03 s5details
#580.01 s5details
#590.01 s5details
#600.02 s5details
#610.02 s5details
#620.02 s5details
#630.02 s5details
#640.01 s5details
#650.02 s5details
#660.02 s5details
#67--6details
#680.02 s6details
#690.02 s6details
#700.01 s6details
#710.02 s6details
#720.01 s6details
#730.02 s6details
#740.01 s6details
#750.03 s6details
#760.03 s6details
#770.02 s6details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:59:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int64_t i=0; i<s.size(); i++){
                      ~^~~~~~~~~

Code

#include <bits/stdc++.h>
#include <stdint.h>
using namespace std;

int64_t n;
int64_t t[31];
bool m[2000][30];


void jotain(int64_t index, int64_t sum, bool u[]){
  for(int64_t i=0; i<n; i++){
    if(!u[i]){
      m[sum][i] = 1;
    }
  }
  if(index < n){
    jotain(index+1,sum,u);
    u[index] = 1;
    jotain(index+1,sum+t[index],u);
    u[index] = 0;
  }
}

int main(){
  cin >> n;
  int64_t sum=0;
  for(int64_t i=0; i<n; i++){
    cin >> t[i];
    sum+= t[i];
  }
  for(int64_t i=0; i<=sum; i++){
    for(int64_t i2=0; i2<n; i2++){
      m[i][i2] = 0;
    }
  }
  bool used[30];
  for(int64_t i=0; i<n; i++){
    used[i] =0;
  }
  jotain(1,0,used);
  used[0] = 1;
  jotain(1,t[0],used);
  vector<int64_t> s;
  for(int64_t i=1; i<sum; i++){
    s.push_back(i);
    for(int64_t i2=0; i2<n; i2++){
      if((sum-t[i2]+i)%2==1){
	s.pop_back();
	break;
      }
      if(!m[(sum-t[i2]+i)/2][i2]){
	s.pop_back();
	break;
      }
    }
  }
  if((sum%2==0) && (m[sum/2][0])){
    cout << s.size() << "\n";
    for(int64_t i=0; i<s.size(); i++){
      cout << s[i] << " ";
    }
    cout << "\n";
  }
  else{
    cout << "0\n";
  }
 
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
4
1 3 1 5

correct output
1

user output
1

Test 2

Group: 1

Verdict: ACCEPTED

input
6
3 5 7 11 9 13

correct output
4
1 3 17 19 

user output
4
1 3 17 19 

Test 3

Group: 1

Verdict: ACCEPTED

input
3
2 2 2

correct output
0

user output
0

Test 4

Group: 1

Verdict: ACCEPTED

input
4
200 200 200 200

correct output
2
200 600 

user output
2
200 600 

Test 5

Group: 1

Verdict: ACCEPTED

input
12
51 45 111 103 155 59 35 11 75 ...

correct output
122
3 5 13 15 19 21 27 29 31 33 37...

user output
122
3 5 13 15 19 21 27 29 31 33 37...

Test 6

Group: 1

Verdict: ACCEPTED

input
8
11 13 31 23 51 11 45 13

correct output
3
33 39 51 

user output
3
33 39 51 

Test 7

Group: 1

Verdict: ACCEPTED

input
6
77 21 35 49 91 49

correct output
1
133 

user output
1
133 

Test 8

Group: 1

Verdict: ACCEPTED

input
12
150 190 138 198 198 66 126 10 ...

correct output
140
2 6 10 14 18 22 26 30 34 38 42...

user output
140
2 6 10 14 18 22 26 30 34 38 42...

Test 9

Group: 1

Verdict: ACCEPTED

input
10
32 71 89 38 82 36 16 84 69 33

correct output
0

user output
0

Test 10

Group: 2

Verdict:

input
30
19 19 19 19 19 19 19 19 19 19 ...

correct output
15
19 57 95 133 171 209 247 285 3...

user output
(empty)

Test 11

Group: 2

Verdict:

input
30
3 15 11 3 3 17 9 9 1 17 5 15 1...

correct output
118
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 12

Group: 2

Verdict:

input
30
18 20 12 16 18 6 2 4 14 16 12 ...

correct output
0

user output
(empty)

Test 13

Group: 2

Verdict:

input
26
6 20 5 7 4 11 16 7 1 15 10 9 1...

correct output
0

user output
(empty)

Test 14

Group: 2

Verdict:

input
28
17 15 5 7 5 15 19 3 9 5 15 15 ...

correct output
135
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 15

Group: 2

Verdict:

input
28
3 3 5 3 5 1 19 3 5 9 3 1 9 9 1...

correct output
101
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 16

Group: 2

Verdict:

input
30
3 3 13 13 1 7 1 7 9 3 7 19 1 3...

correct output
117
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 17

Group: 2

Verdict: ACCEPTED

input
18
9 5 5 19 19 13 13 3 1 19 5 3 7...

correct output
81
1 3 5 7 9 11 13 15 17 19 21 23...

user output
81
1 3 5 7 9 11 13 15 17 19 21 23...

Test 18

Group: 2

Verdict:

input
24
17 5 1 9 7 13 17 7 17 7 9 13 1...

correct output
112
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 19

Group: 2

Verdict:

input
26
17 13 9 9 19 3 5 3 7 5 9 5 7 7...

correct output
87
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 20

Group: 2

Verdict:

input
30
20 20 20 20 20 20 20 20 20 20 ...

correct output
15
20 60 100 140 180 220 260 300 ...

user output
(empty)

Test 21

Group: 3

Verdict:

input
64
61 65 13 49 83 3 71 87 45 39 2...

correct output
1523
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 22

Group: 3

Verdict:

input
74
93 69 63 89 13 85 47 65 23 13 ...

correct output
1656
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 23

Group: 3

Verdict:

input
50
11 27 27 95 49 49 27 27 41 63 ...

correct output
1113
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 24

Group: 3

Verdict:

input
94
27 41 75 17 25 63 85 29 1 83 3...

correct output
2252
1 3 5 7 9 11 13 15 17 19 21 23...

user output
0

Test 25

Group: 3

Verdict:

input
94
99 99 97 97 95 95 89 97 91 95 ...

correct output
2952
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 26

Group: 3

Verdict:

input
100
91 95 89 89 93 95 97 95 99 95 ...

correct output
3239
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 27

Group: 3

Verdict:

input
100
90 90 90 82 90 90 98 78 78 98 ...

correct output
1892
2 6 10 14 18 22 26 30 34 38 42...

user output
(empty)

Test 28

Group: 3

Verdict:

input
100
98 98 94 98 98 94 90 98 90 98 ...

correct output
1516
2 6 10 14 18 22 26 30 34 38 42...

user output
(empty)

Test 29

Group: 3

Verdict:

input
100
99 97 99 99 95 99 97 99 95 97 ...

correct output
840
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 30

Group: 3

Verdict:

input
100
13 49 3 89 88 49 58 31 68 19 4...

correct output
0

user output
(empty)

Test 31

Group: 3

Verdict:

input
100
59 55 69 93 77 87 95 89 85 55 ...

correct output
3535
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 32

Group: 3

Verdict:

input
100
99 35 99 35 25 3 29 49 93 47 5...

correct output
2320
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 33

Group: 3

Verdict:

input
100
100 100 100 100 100 100 100 10...

correct output
50
100 300 500 700 900 1100 1300 ...

user output
(empty)

Test 34

Group: 3

Verdict:

input
100
99 99 99 99 99 99 99 99 99 99 ...

correct output
50
99 297 495 693 891 1089 1287 1...

user output
(empty)

Test 35

Group: 3

Verdict:

input
100
97 97 95 97 97 95 97 97 95 97 ...

correct output
196
1 3 5 7 187 189 191 193 195 19...

user output
(empty)

Test 36

Group: 3

Verdict:

input
100
89 45 21 35 5 43 1 35 53 89 9 ...

correct output
2285
1 3 5 7 9 11 13 15 17 19 21 23...

user output
159
1 3 5 7 9 11 13 15 17 19 21 23...

Test 37

Group: 4

Verdict:

input
200
135 105 103 137 51 61 117 69 1...

correct output
9478
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 38

Group: 4

Verdict:

input
200
147 135 79 131 121 97 149 83 8...

correct output
9770
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 39

Group: 4

Verdict:

input
248
249 249 249 249 249 249 249 24...

correct output
124
249 747 1245 1743 2241 2739 32...

user output
(empty)

Test 40

Group: 4

Verdict:

input
270
137 87 235 239 165 269 15 201 ...

correct output
16063
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 41

Group: 4

Verdict:

input
270
270 270 270 270 270 270 270 27...

correct output
135
270 810 1350 1890 2430 2970 35...

user output
(empty)

Test 42

Group: 4

Verdict:

input
250
71 79 29 83 87 161 171 43 43 5...

correct output
14889
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 43

Group: 4

Verdict:

input
244
217 211 209 207 223 241 245 20...

correct output
25704
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 44

Group: 4

Verdict:

input
248
205 233 215 221 213 229 249 23...

correct output
26260
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 45

Group: 4

Verdict:

input
250
215 219 213 205 211 243 239 23...

correct output
26502
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 46

Group: 4

Verdict:

input
270
42 178 50 198 148 4 98 152 172...

correct output
0

user output
(empty)

Test 47

Group: 4

Verdict:

input
250
167 123 213 69 201 197 153 73 ...

correct output
16136
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 48

Group: 4

Verdict:

input
250
241 249 249 245 245 249 243 24...

correct output
18952
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 49

Group: 4

Verdict:

input
250
245 247 249 245 245 249 249 24...

correct output
4793
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 50

Group: 4

Verdict:

input
250
137 79 63 203 137 199 103 141 ...

correct output
16242
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 51

Group: 4

Verdict:

input
250
25 114 237 180 130 177 162 118...

correct output
0

user output
(empty)

Test 52

Group: 4

Verdict:

input
270
253 267 263 257 267 265 263 26...

correct output
29010
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 53

Group: 5

Verdict:

input
300
169 137 45 201 181 93 49 97 27...

correct output
22553
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 54

Group: 5

Verdict:

input
350
193 179 173 205 265 87 29 243 ...

correct output
27543
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 55

Group: 5

Verdict:

input
350
305 309 315 317 319 317 307 31...

correct output
48733
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 56

Group: 5

Verdict:

input
306
147 107 247 213 253 265 37 45 ...

correct output
27574
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 57

Group: 5

Verdict:

input
350
347 349 325 333 345 335 321 33...

correct output
52392
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 58

Group: 5

Verdict:

input
350
79 335 175 171 307 239 63 3 21...

correct output
30384
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 59

Group: 5

Verdict:

input
350
185 283 157 199 195 123 127 18...

correct output
37688
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 60

Group: 5

Verdict:

input
350
57 19 32 305 10 45 60 82 104 1...

correct output
0

user output
(empty)

Test 61

Group: 5

Verdict:

input
350
279 153 293 183 309 273 319 24...

correct output
42216
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 62

Group: 5

Verdict:

input
320
293 317 315 333 261 319 291 33...

correct output
46225
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 63

Group: 5

Verdict:

input
320
347 337 301 335 323 331 333 34...

correct output
48310
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 64

Group: 5

Verdict:

input
314
333 321 321 335 335 315 303 30...

correct output
47592
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 65

Group: 5

Verdict:

input
316
140 260 60 260 180 260 260 60 ...

correct output
1194
20 60 100 140 180 220 260 300 ...

user output
(empty)

Test 66

Group: 5

Verdict:

input
310
145 195 285 235 265 245 75 195...

correct output
5275
5 15 25 35 45 55 65 75 85 95 1...

user output
(empty)

Test 67

Group: 6

Verdict:

input
400
1 1 3 3 5 5 7 7 9 9 11 11 13 1...

correct output
39801
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 68

Group: 6

Verdict:

input
500
196 402 352 58 462 284 162 108...

correct output
0

user output
(empty)

Test 69

Group: 6

Verdict:

input
500
427 421 429 417 427 409 427 40...

correct output
100095
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 70

Group: 6

Verdict:

input
500
345 39 453 289 341 429 397 397...

correct output
63809
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 71

Group: 6

Verdict:

input
500
161 357 285 223 269 155 483 29...

correct output
61840
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 72

Group: 6

Verdict:

input
500
97 221 235 16 407 43 33 454 47...

correct output
0

user output
(empty)

Test 73

Group: 6

Verdict:

input
499
499 362 138 107 439 227 296 34...

correct output
0

user output
(empty)

Test 74

Group: 6

Verdict:

input
498
409 487 415 479 469 469 469 43...

correct output
108504
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 75

Group: 6

Verdict:

input
498
483 309 473 389 343 425 337 30...

correct output
86205
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 76

Group: 6

Verdict:

input
500
495 491 497 483 497 487 489 49...

correct output
102728
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)

Test 77

Group: 6

Verdict:

input
500
479 471 455 455 467 461 469 44...

correct output
111377
1 3 5 7 9 11 13 15 17 19 21 23...

user output
(empty)