QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#736720#9615. 骨牌覆盖hos_lyric#45 5ms4164kbC++142.9kb2024-11-12 12:49:462024-11-12 12:49:46

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 12:49:46]
  • 评测
  • 测评结果:45
  • 用时:5ms
  • 内存:4164kb
  • [2024-11-12 12:49:46]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


int N;
vector<Int> A;

#define A do_not_use_A
vector<Int> B[2], BSum[2];
void build() {
  for (int h = 0; h < 2; ++h) {
    BSum[h].assign(N + 1, 0);
    for (int i = 0; i < N; ++i) {
      BSum[h][i + 1] = BSum[h][i] + B[h][i];
    }
  }
}

// l -> min bad r
vector<int> brute() {
  vector<int> rs(N + 1, N + 1);
  for (int l = 0; l < N; ++l) {
    Int now[2] = {};
    for (int i = l; i < N; ++i) {
      if (l <= i - 1) {
        // Hall for side 0 in [l, i)
        if (now[0] > now[1] + min(B[0][i - 1], B[1][i])) {
          rs[l] = i + 1;
          break;
        }
      }
      for (int h = 0; h < 2; ++h) now[h] += B[h][i];
    }
  }
  return rs;
}
#undef A

int main() {
  for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    scanf("%d", &N);
    A.resize(N);
    for (int i = 0; i < N; ++i) {
      scanf("%lld", &A[i]);
    }
    
    for (int h = 0; h < 2; ++h) {
      B[h].resize(N);
      for (int i = 0; i < N; ++i) {
        B[h][i] = (A[i] + (h ^ (i & 1) ^ 1)) / 2;
      }
    }
    
    build();
    auto fs = brute();
    for (int h = 0; h < 2; ++h) reverse(B[h].begin(), B[h].end());
    build();
    auto gs = brute();
    for (int h = 0; h < 2; ++h) reverse(B[h].begin(), B[h].end());
    build();
    
    reverse(gs.begin(), gs.end());
    for (int r = 0; r <= N; ++r) gs[r] = N - gs[r];
    
    int ans = 0;
    for (int l = 0; l <= N; ++l) for (int r = l + 1; r <= N; ++r) if (r < fs[l] && gs[r] < l) {
      if (BSum[0][r] - BSum[0][l] == BSum[1][r] - BSum[1][l]) {
        ++ans;
      }
    }
    printf("%d\n", ans);
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 4048kb

input:

100
10
6 6 5 7 5 4 5 6 10 2
10
3 0 5 4 6 6 6 3 1 10
10
5 3 3 4 7 7 7 5 4 1
10
9 5 6 4 5 5 9 0 3 0
10
5 8 8 5 7 7 1 6 4 2
10
5 8 4 5 1 7 2 5 5 1
10
5 8 6 5 7 5 5 0 10 2
10
4 6 1 10 1 9 3 1 7 4
10
5 3 10 5 5 9 0 2 9 7
10
5 8 9 9 4 8 4 5 9 3
10
5 5 1 1 4 9 9 8 5 4
10
5 8 9 9 8 5 9 5 5 6
10
6 6 6 7 6 9 ...

output:

15
24
19
17
31
17
31
15
16
24
21
24
17
16
18
24
24
29
27
16
21
25
17
16
13
23
17
31
22
12
23
27
29
27
25
13
15
23
23
21
25
25
31
16
24
27
31
27
24
15
23
15
23
24
17
7
16
21
29
16
12
16
14
14
29
24
19
29
17
16
29
22
20
23
13
15
25
21
22
27
21
13
24
29
19
16
15
19
21
25
21
20
29
14
14
17
23
10
17
27

result:

ok 100 lines

Test #2:

score: 5
Accepted
time: 1ms
memory: 4092kb

input:

100
10
5 3 5 4 7 5 9 9 6 5
10
2 7 7 6 10 10 0 7 9 6
10
5 6 8 5 10 4 6 5 10 7
10
5 5 6 2 10 8 7 5 0 1
10
5 5 7 5 8 9 9 8 5 10
10
3 3 9 1 9 4 6 4 3 5
10
5 2 9 9 6 5 2 5 7 3
5
5 1 1 1 1
9
4 6 5 6 6 5 0 1 7
10
5 6 6 8 8 5 7 0 0 0
10
3 6 9 7 6 3 10 7 9 0
10
5 6 8 6 6 5 1 7 8 9
10
10 5 5 5 3 10 7 6 4 2
10...

output:

19
36
14
29
21
24
13
6
18
37
16
21
17
16
24
14
25
27
21
21
19
18
24
37
16
17
19
21
31
19
16
29
20
29
17
24
12
21
27
27
18
36
20
16
21
12
21
21
15
20
15
27
12
37
25
29
25
24
23
27
16
13
29
19
16
31
16
17
24
27
29
24
18
23
31
31
17
14
12
16
29
29
13
27
10
29
36
13
16
22
12
21
12
29
16
16
19
29
17
29

result:

ok 100 lines

Test #3:

score: 5
Accepted
time: 1ms
memory: 3828kb

input:

100
10
6 3 4 6 10 6 7 10 10 9
10
3 6 6 5 9 2 9 7 8 9
10
5 8 7 9 8 3 1 8 1 9
10
6 6 4 5 4 8 6 8 5 7
10
3 6 4 8 6 6 9 9 8 5
10
4 7 10 8 6 902932233 9 8 7 6
10
6 5 8 9 5 9 9 6 5 5
10
5 8 7 9 8 5 4 4 6 10
10
4 5 5 2 7 5 6 4 5 1
10
5 6 5 9 6 5 8 5 3 4
10
4 7 8 10 8 6 7 5 5 4
10
5 3 3 10 3 4 2 6 6 4
10
5 ...

output:

25
24
22
25
29
21
19
21
29
16
25
19
21
25
20
17
29
21
16
24
11
21
16
24
29
31
14
27
21
19
19
21
37
27
16
28
37
27
24
25
29
28
25
20
29
11
15
23
21
17
13
25
25
10
15
31
17
31
37
21
17
21
37
23
23
17
24
12
16
20
21
10
23
25
31
21
19
25
27
16
27
24
16
24
13
13
21
13
29
18
25
31
22
31
28
28
36
23
29
19

result:

ok 100 lines

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #4:

score: 20
Accepted
time: 1ms
memory: 4080kb

input:

100
10
1 3 1 0 2 2 4 0 1 2
10
3 4 3 5 1 5 4 1 4 5
10
4 5 1 1 2 1 3 2 3 2
10
3 0 3 5 1 0 1 4 5 1
10
1 2 2 2 1 0 1 4 2 0
10
0 3 4 5 5 5 4 2 1 4
10
5 0 0 2 5 4 1 5 3 5
10
5 1 2 2 4 5 1 5 4 3
10
5 3 4 2 1 1 1 1 2 5
10
5 1 4 1 2 1 1 2 2 2
10
1 3 4 2 4 1 4 4 1 2
10
1 0 1 3 0 0 3 3 3 1
10
1 4 0 3 4 0 5 4 0...

output:

23
12
14
9
13
17
13
18
24
18
24
22
12
9
13
16
24
31
17
16
16
21
18
24
25
18
24
21
23
10
29
18
14
36
25
31
29
20
29
21
22
28
9
20
24
12
14
15
10
25
16
14
17
15
29
28
25
17
28
22
12
19
16
12
14
25
13
17
17
16
24
13
18
25
19
16
27
12
14
25
16
28
15
9
10
16
29
25
21
22
12
14
10
21
12
16
9
29
27
25

result:

ok 100 lines

Test #5:

score: 20
Accepted
time: 0ms
memory: 3736kb

input:

100
10
1 1 1 1 0 0 0 0 0 1
10
1 0 0 3 1 2 5 2 3 4
10
1 0 3 1 0 2 5 5 1 4
10
1 0 0 3 2 5 3 3 5 2
10
1 0 3 0 2 1 2 0 3 4
10
1 0 3 3 2 5 4 4 3 3
10
1 1 0 3 0 1 5 2 7 2
10
1 0 3 0 2 1 5 2 1 2
10
1 1 1 0 0 3 0 2 1 0
10
1 0 3 2 5 4 0 2 4 4
10
1 0 1 1 2 1 1 3 1 2
10
1 0 0 0 1 0 0 5 1 1
10
1 0 0 0 3 1 0 1 3...

output:

29
12
18
14
8
16
10
12
11
17
22
13
22
22
8
21
22
8
14
6
17
10
10
13
14
9
21
9
6
28
16
6
8
8
14
9
16
16
9
6
8
8
14
16
13
8
16
8
9
12
9
22
22
21
16
14
13
22
13
13
17
8
10
16
10
8
9
8
6
10
12
13
6
6
13
12
8
8
21
22
16
9
13
13
16
13
24
24
36
16
18
8
21
16
6
13
8
14
8
7

result:

ok 100 lines

Test #6:

score: 20
Accepted
time: 1ms
memory: 3832kb

input:

60
82
5 6 9 8 10 12 8 7 6 5 29 55 5 4 5 10 13 16 14 13 13 16 17 13 16 9 10 12 10 9 8 5 7 3 4 8 6 8 5 60 27 42 5 8 9 7 8 3 72 42 5 6 9 10 11 9 6 8 6 7 9 9 6 8 6 6 8 5 27 18 14 37 4 6 6 7 5 6 24 58 80 54
86
1 6 9 8 10 9 7 9 6 6 9 7 8 6 6 1 64 55 31 64 38 11 80 5 6 9 10 13 11 4 10 9 12 17 17 14 12 16 1...

output:

661
425
776
940
840
1052
439
732
634
1171
728
592
938
1003
636
730
1032
1018
985
893
646
489
650
638
927
626
1192
1442
673
1131
879
760
1086
1079
386
1022
758
1282
648
1019
892
398
1219
585
1054
564
694
1189
1039
931
1310
754
436
525
970
1040
490
584
946
710

result:

ok 60 lines

Test #7:

score: 20
Accepted
time: 1ms
memory: 3808kb

input:

100
56
5 6 9 5 7 10 13 6 12 14 16 9 12 9 7 8 8 9 6 6 6 6 5 9 4 5 8 5 6 3 12 11 14 15 17 14 11 13 13 8 7 6 6 7 8 8 5 6 6 9 7 8 5 18 28 18
42
1 8 9 8 11 13 12 9 8 6 2 8 6 8 6 5 5 6 7 12 11 14 6 7 10 7 9 10 12 9 6 6 6 4 8 5 5 35 4 6 21 10
47
5 6 9 6 10 12 13 11 10 5 9 10 6 9 7 7 9 9 8 4 5 12 7 9 4 9 8 ...

output:

213
304
316
275
636
142
200
283
416
298
265
546
136
341
286
226
194
312
454
138
455
285
205
395
169
451
385
417
295
372
349
256
423
256
473
304
275
531
186
451
580
295
315
372
255
268
294
205
194
394
436
300
409
243
264
247
344
567
355
253
271
383
256
446
289
371
234
404
340
271
402
269
246
236
1794...

result:

ok 100 lines

Test #8:

score: 20
Accepted
time: 0ms
memory: 3812kb

input:

100
45
3 8 7 12 13 14 17 12 21 21 8 17 12 14 12 14 17 13 14 13 12 8 10 10 8 12 12 9 9 7 8 8 6 8 9 9 8 6 8 5 44 34 18 3 5
53
5 8 7 4 11 5 8 10 10 5 9 10 10 9 9 10 11 13 8 9 9 9 9 5 4 6 7 10 13 13 8 8 12 7 6 4 7 7 8 5 11 0 6 7 6 10 7 7 7 6 12 36 14
34
5 8 8 6 6 5 32 11 31 8 3 6 8 8 9 9 7 9 6 8 6 5 19 ...

output:

193
494
214
357
236
454
377
267
349
381
480
433
287
517
280
162
448
499
245
583
299
274
339
196
271
872
394
247
370
354
284
257
305
585
310
696
528
354
349
547
114
328
246
235
405
424
340
341
386
340
446
220
281
252
131
260
356
197
207
546
246
321
332
333
1562
392
383
277
141
331
458
383
254
104
277...

result:

ok 100 lines

Test #9:

score: 20
Accepted
time: 1ms
memory: 3796kb

input:

100
50
5 5 9 0 6 6 8 6 7 1 8 6 4 6 2 1 8 9 9 1 6 9 0 9 5 5 2 4 1 4 7 7 4 8 3 6 2 2 1 10 4 6 5 9 8 5 2 7 8 10
50
9 6 1 2 6 2 5 0 7 7 9 2 9 2 4 8 6 10 9 7 3 0 3 7 6 10 1 2 2 9 4 8 10 0 6 5 9 7 7 4 5 6 1 4 7 9 1 9 8 6
50
6 8 3 10 7 9 1 9 9 10 10 8 6 1 7 1 0 0 6 0 4 1 8 9 8 8 4 1 0 6 4 8 10 10 5 1 9 5 7...

output:

158
163
156
123
319
180
187
183
230
151
515
303
111
335
249
79
146
192
158
145
121
125
169
175
126
158
127
164
115
304
200
413
154
251
157
187
249
221
106
124
200
133
173
122
191
309
406
162
181
241
115
176
114
292
97
128
157
188
99
202
191
143
146
141
175
186
169
179
147
142
170
158
189
117
183
219...

result:

ok 100 lines

Test #10:

score: 20
Accepted
time: 1ms
memory: 4088kb

input:

100
50
6 16 19 1 20 0 3 13 5 18 19 15 5 17 0 15 14 0 19 1 12 0 4 6 11 13 16 1 11 12 15 1 11 12 7 8 18 1 6 20 16 1 11 9 16 20 5 5 10 11
50
6 15 15 5 1 4 19 0 3 5 6 12 12 2 4 10 16 4 9 8 13 14 19 16 20 12 1 11 0 1 4 9 6 16 19 9 10 15 18 13 14 10 6 13 18 19 5 14 2 17
50
8 4 4 19 0 7 1 11 8 18 16 3 9 13...

output:

169
116
123
228
159
264
271
284
205
278
149
183
245
276
93
179
265
271
156
128
327
152
221
119
86
126
166
262
217
296
160
168
179
147
151
141
374
197
288
171
693
240
167
234
144
171
251
255
171
197
294
182
202
142
439
173
133
163
115
102
256
172
151
320
183
123
217
214
300
118
139
248
92
225
134
115...

result:

ok 100 lines

Test #11:

score: 20
Accepted
time: 1ms
memory: 3764kb

input:

100
50
51 24 2 38 28 31 51 54 50 31 80 52 34 48 29 22 61 79 0 0 70 68 80 1 75 37 52 49 50 22 36 5 19 91 9 15 64 27 77 29 32 19 72 85 70 42 37 65 48 15
50
76 88 7 46 55 87 61 25 11 14 1 26 83 41 58 32 49 41 9 9 59 35 51 19 50 32 49 57 78 20 19 53 49 60 29 28 17 27 77 80 12 30 46 89 88 18 100 63 40 84...

output:

201
222
211
110
292
371
227
184
239
223
248
293
185
172
175
419
219
185
282
286
234
505
199
126
274
239
274
236
208
223
190
306
303
270
251
397
269
275
280
226
325
262
377
285
223
266
326
286
257
171
406
257
262
394
342
268
187
203
374
169
310
276
248
148
494
136
248
242
182
341
201
279
233
280
362
...

result:

ok 100 lines

Test #12:

score: 20
Accepted
time: 1ms
memory: 3800kb

input:

100
50
1 0 0 1 2 0 1 1 5 0 7 2 7 0 3 6 7 6 5 5 12 5 17 8 17 4 3 13 4 2 16 16 13 8 14 6 22 17 19 20 16 19 0 11 22 28 25 4 33 10
50
1 0 0 3 0 1 0 1 7 7 5 7 2 7 6 3 0 8 8 13 5 1 3 0 5 7 0 17 7 2 0 6 16 11 5 6 15 14 2 11 11 18 19 16 5 18 22 3 11 20
50
1 0 3 2 1 3 3 0 7 4 4 0 1 2 11 6 9 8 9 7 14 17 2 16 ...

output:

150
177
114
65
109
150
113
74
96
84
166
138
135
108
108
216
114
116
108
269
113
103
108
162
213
118
115
139
117
106
138
99
117
54
98
95
192
83
127
114
82
154
92
168
118
124
119
110
133
131
162
152
173
75
117
173
114
156
165
69
158
152
122
123
124
168
115
131
94
125
104
175
60
107
124
140
109
128
124...

result:

ok 100 lines

Test #13:

score: 20
Accepted
time: 0ms
memory: 3828kb

input:

100
50
1 1 0 3 0 3 2 5 2 7 9 5 1 6 0 9 1 6 11 0 3 3 0 13 4 11 16 19 14 9 12 5 20 1 16 6 18 19 4 23 8 0 1 3 30 6 30 31 6 2
50
1 1 0 3 3 1 0 0 5 3 2 2 4 1 1 0 3 6 6 9 8 1 0 7 9 3 12 5 0 15 14 2 4 1 13 19 3 12 18 6 21 20 13 17 9 18 15 11 10 10
50
1 1 0 0 1 0 5 2 1 6 1 0 11 4 2 8 8 3 1 3 3 0 0 3 5 3 5 2...

output:

76
137
198
119
192
106
105
116
157
75
91
119
98
118
100
86
124
160
323
115
163
138
115
114
75
69
143
200
121
92
98
104
93
85
161
111
208
156
139
90
93
191
111
115
190
150
133
97
152
65
82
131
99
310
74
90
108
71
104
99
181
118
96
137
97
114
88
113
91
128
143
111
81
110
130
190
111
149
171
239
96
133...

result:

ok 100 lines

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #14:

score: 20
Accepted
time: 5ms
memory: 3856kb

input:

5
813
5 6 5 12 11 14 17 15 14 12 17 18 20 9 16 14 14 12 16 11 13 16 13 14 21 14 21 17 19 21 22 20 14 19 19 21 16 10 10 15 14 12 17 17 10 10 15 17 15 16 16 13 17 13 15 15 14 12 8 10 16 11 13 2 17 16 18 12 18 17 9 17 15 17 14 9 13 14 15 6 21 20 12 17 19 18 22 9 20 14 19 19 20 20 20 15 17 10 19 20 22 2...

output:

45945
52622
33362
60292
50040

result:

ok 5 lines

Test #15:

score: 20
Accepted
time: 3ms
memory: 3908kb

input:

10
420
6 7 10 11 10 7 12 16 15 14 12 9 13 12 12 12 7 11 11 10 6 10 8 4 5 5 10 7 14 13 13 15 16 18 16 12 16 19 16 20 15 11 15 14 15 10 12 9 14 11 17 13 17 14 15 15 15 11 13 12 10 15 14 9 20 16 22 23 20 19 26 27 23 28 17 22 23 5 20 27 17 22 21 18 17 17 18 17 21 16 19 17 22 14 13 13 15 16 16 19 19 19 1...

output:

11572
15453
21201
10334
19626
9374
28098
22868
16940
15128

result:

ok 10 lines

Test #16:

score: 20
Accepted
time: 5ms
memory: 4160kb

input:

5
794
5 8 5 10 10 10 11 14 11 11 16 11 13 14 17 12 11 14 20 22 25 20 29 22 33 32 36 29 25 17 22 23 23 24 27 31 25 32 30 13 32 24 31 22 21 15 28 33 14 30 13 20 37 27 32 34 29 35 28 19 31 21 25 29 32 23 29 32 20 13 24 26 28 25 25 21 24 19 14 16 21 18 21 19 16 20 25 22 16 23 15 19 17 25 12 21 12 12 17 ...

output:

22135
20170
24359
17619
10934

result:

ok 5 lines

Test #17:

score: 20
Accepted
time: 5ms
memory: 4164kb

input:

5
822
5 6 7 10 9 14 16 12 12 9 13 13 10 10 13 12 8 11 11 9 7 13 11 13 11 9 12 10 10 10 9 11 10 10 10 10 9 11 10 12 12 10 8 10 10 12 8 4 8 12 10 12 10 10 6 10 12 9 9 10 13 11 13 12 14 14 16 12 14 11 11 8 12 9 13 12 16 13 9 13 13 9 9 11 10 10 13 13 9 9 11 13 2 10 13 11 10 10 12 10 10 12 6 6 8 8 12 12 ...

output:

119864
88745
92989
84487
131242

result:

ok 5 lines

Test #18:

score: 20
Accepted
time: 3ms
memory: 3896kb

input:

5
1000
8 7 7 8 4 6 4 8 0 1 2 4 7 7 0 9 6 0 7 2 6 1 2 3 3 2 10 6 4 2 0 9 4 4 4 10 3 9 0 10 9 2 8 4 6 8 8 7 6 5 6 6 2 1 2 5 0 8 5 6 8 5 6 7 8 8 4 0 2 2 10 7 5 8 10 10 1 2 10 0 10 1 0 6 1 4 8 5 3 10 5 2 7 7 3 7 6 4 7 7 6 2 2 7 9 4 0 3 9 9 7 9 1 0 9 5 2 0 5 6 7 9 3 7 10 3 3 4 7 4 1 10 10 3 6 2 7 2 10 2 ...

output:

4938
4643
4300
5856
4587

result:

ok 5 lines

Test #19:

score: 20
Accepted
time: 4ms
memory: 4124kb

input:

5
1000
39 7 9 7 33 2 22 4 31 49 19 27 22 39 17 5 50 13 9 23 1 40 37 8 7 3 7 29 1 47 29 35 20 10 19 17 17 4 27 18 24 45 13 43 16 15 10 50 10 22 46 36 31 13 41 29 44 47 41 35 9 36 39 33 37 28 9 37 8 40 32 49 32 2 18 32 11 21 38 46 2 26 11 42 43 10 17 29 34 26 30 28 21 36 43 29 7 45 28 33 44 18 14 47 1...

output:

7846
12495
7596
8102
7248

result:

ok 5 lines

Test #20:

score: 20
Accepted
time: 5ms
memory: 3780kb

input:

5
1000
45 62 187 29 174 21 130 154 4 2 133 173 160 74 11 155 195 116 129 125 94 8 34 52 148 57 189 137 140 62 192 152 0 14 5 117 65 198 92 180 149 181 162 83 61 128 105 17 182 61 171 35 159 2 49 32 34 82 84 173 134 13 5 63 189 192 199 60 156 167 10 152 52 113 51 86 72 114 105 181 18 67 194 7 168 192...

output:

10321
10866
12170
17957
8834

result:

ok 5 lines

Test #21:

score: 20
Accepted
time: 4ms
memory: 4124kb

input:

5
1000
1 0 3 1 2 5 1 3 0 5 1 7 3 4 1 0 7 7 10 13 11 12 3 15 9 2 7 15 14 11 17 14 19 20 1 6 5 8 25 22 23 5 14 5 12 19 28 4 20 29 24 11 32 30 11 10 7 40 27 30 33 16 39 18 39 11 26 29 7 50 21 21 10 55 19 43 18 2 48 30 31 5 52 43 10 9 31 49 6 10 37 54 5 32 50 48 39 44 30 19 52 29 40 60 24 50 50 57 15 5 ...

output:

7211
7471
9895
6909
8115

result:

ok 5 lines

Test #22:

score: 20
Accepted
time: 5ms
memory: 3900kb

input:

5
1000
1 1 0 3 1 0 3 5 3 3 5 1 3 1 3 3 4 1 2 6 1 2 8 1 6 4 8 9 12 13 7 10 2 12 5 14 1 9 10 21 12 3 22 5 14 17 21 27 26 19 11 14 22 11 24 11 6 12 33 26 17 20 37 30 32 21 25 24 23 32 5 44 38 37 16 6 27 18 43 10 32 44 37 42 1 44 4 53 53 12 55 31 18 3 26 3 51 43 1 12 11 6 53 57 43 8 27 10 56 30 61 22 62...

output:

6604
9020
8182
5951
6195

result:

ok 5 lines

Subtask #4:

score: 0
Time Limit Exceeded

Dependency #3:

100%
Accepted

Test #23:

score: 0
Time Limit Exceeded

input:

1
100000
4 7 8 11 6 10 8 8 12 10 8 14 14 14 12 10 8 14 12 14 12 12 14 14 14 8 12 4 4 14 12 14 8 10 12 12 14 10 6 6 12 8 12 10 8 12 12 12 6 8 12 14 10 6 12 8 12 14 8 10 10 8 14 14 14 10 4 10 14 12 10 10 10 12 14 14 12 14 14 14 14 12 5 9 12 14 12 14 12 12 14 10 14 14 10 14 10 14 12 12 8 12 8 10 14 14 ...

output:


result:


Subtask #5:

score: 0
Skipped

Dependency #4:

0%