QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#768471#9615. 骨牌覆盖cmk66645 2ms3904kbC++239.9kb2024-11-21 11:01:592024-11-21 11:02:01

Judging History

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

  • [2024-11-21 11:02:01]
  • 评测
  • 测评结果:45
  • 用时:2ms
  • 内存:3904kb
  • [2024-11-21 11:01:59]
  • 提交

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2024-11-21 10:57:06]
[Last Modified Time: 2024-11-21 11:01:52] */
#ifdef LOCAL
#include<bits/stdc++.h>
#include"debug.h"
#else
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
#define USE_FastIO
// ------------------------------
// #define DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
	inline void _chk_i() {}
	inline char _gc_nochk() { return getchar(); }
	inline char _gc() { return getchar(); }
	inline void _chk_o() {}
	inline void _pc_nochk(char c) { putchar(c); }
	inline void _pc(char c) { putchar(c); }
	template < int n > inline void _pnc_nochk(const char *c) { for ( int i = 0 ; i < n ; i++ ) putchar(c[i]); }
#else
#ifdef DISABLE_MMAP
	inline constexpr int _READ_SIZE = 1 << 18; inline static char _read_buffer[_READ_SIZE + 40], *_read_ptr = nullptr, *_read_ptr_end = nullptr; static inline bool _eof = false;
	inline void _chk_i() { if ( __builtin_expect(!_eof, true) && __builtin_expect(_read_ptr_end - _read_ptr < 40, false) ) { int sz = _read_ptr_end - _read_ptr; if ( sz ) memcpy(_read_buffer, _read_ptr, sz); char *beg = _read_buffer + sz; _read_ptr = _read_buffer, _read_ptr_end = beg + fread(beg, 1, _READ_SIZE, stdin); if ( __builtin_expect(_read_ptr_end != beg + _READ_SIZE, false) ) _eof = true, *_read_ptr_end = EOF; } }
	inline char _gc_nochk() { return __builtin_expect(_eof && _read_ptr == _read_ptr_end, false) ? EOF : *_read_ptr++; }
	inline char _gc() { _chk_i(); return _gc_nochk(); }
#else
#include<sys/mman.h>
#include<sys/stat.h>
	inline static char *_read_ptr = (char *)mmap(nullptr, [] { struct stat s; return fstat(0, &s), s.st_size; } (), 1, 2, 0, 0);
	inline void _chk_i() {}
	inline char _gc_nochk() { return *_read_ptr++; }
	inline char _gc() { return *_read_ptr++; }
#endif
	inline constexpr int _WRITE_SIZE = 1 << 18; inline static char _write_buffer[_WRITE_SIZE + 40], *_write_ptr = _write_buffer;
	inline void _chk_o() { if ( __builtin_expect(_write_ptr - _write_buffer > _WRITE_SIZE, false) ) fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer; }
	inline void _pc_nochk(char c) { *_write_ptr++ = c; }
	inline void _pc(char c) { *_write_ptr++ = c, _chk_o(); }
	template < int n > inline void _pnc_nochk(const char *c) { memcpy(_write_ptr, c, n), _write_ptr += n; }
	inline struct _auto_flush { inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); } } _auto_flush;
#endif
#define println println_ // don't use C++23 std::println
	template < class T > inline constexpr bool _is_signed = numeric_limits < T >::is_signed;
	template < class T > inline constexpr bool _is_unsigned = numeric_limits < T >::is_integer && !_is_signed < T >;
#if __SIZEOF_LONG__ == 64
	template <> inline constexpr bool _is_signed < __int128 > = true;
	template <> inline constexpr bool _is_unsigned < __uint128_t > = true;
#endif
	inline bool _isgraph(char c) { return c >= 33; }
	inline bool _isdigit(char c) { return 48 <= c && c <= 57; } // or faster, remove c <= 57
	constexpr struct _table {
#ifndef LOCAL
	int i[65536];
#endif
	char o[40000]; constexpr _table() :
#ifndef LOCAL
	i{},
#endif
	o{} {
#ifndef LOCAL
	for ( int x = 0 ; x < 65536 ; x++ ) i[x] = -1; for ( int x = 0 ; x <= 9 ; x++ ) for ( int y = 0 ; y <= 9 ; y++ ) i[x + y * 256 + 12336] = x * 10 + y;
#endif
	for ( int x = 0 ; x < 10000 ; x++ ) for ( int y = 3, z = x ; ~y ; y-- ) o[x * 4 + y] = z % 10 + 48, z /= 10; } } _table;
	template < class T, int digit > inline constexpr T _pw10 = 10 * _pw10 < T, digit - 1 >;
	template < class T > inline constexpr T _pw10 < T, 0 > = 1;
	inline void read(char &c) { do c = _gc(); while ( !_isgraph(c) ); }
	inline void read_cstr(char *s) { char c = _gc(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) *s++ = c, c = _gc(); *s = 0; }
	inline void read(string &s) { char c = _gc(); s.clear(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) s.push_back(c), c = _gc(); }
	template < class T, bool neg >
#ifndef LOCAL
	__attribute__((no_sanitize("undefined")))
#endif
	inline void _read_int_suf(T &x) { _chk_i(); char c; while
#ifndef LOCAL
	( ~_table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)] ) if constexpr ( neg ) x = x * 100 - _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; else x = x * 100 + _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; if
#endif
	( _isdigit(c = _gc_nochk()) ) if constexpr ( neg ) x = x * 10 - ( c & 15 ); else x = x * 10 + ( c & 15 ); }
	template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ) if ( c == 45 ) { _read_int_suf < T, true >(x = -( _gc_nochk() & 15 )); return; } _read_int_suf < T, false >(x = c & 15); }
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ); _read_int_suf < T, false >(x = c & 15); }
	inline void write(bool x) { _pc(x | 48); }
	inline void write(char c) { _pc(c); }
	inline void write_cstr(const char *s) { while ( *s ) _pc(*s++); }
	inline void write(const string &s) { for ( char c : s ) _pc(c); }
	template < class T, bool neg, int digit > inline void _write_int_suf(T x) { if constexpr ( digit == 4 ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _write_int_suf < T, neg, digit / 2 >(x / _pw10 < T, digit / 2 >), _write_int_suf < T, neg, digit / 2 >(x % _pw10 < T, digit / 2 >); }
	template < class T, bool neg, int digit > inline void _write_int_pre(T x) { if constexpr ( digit <= 4 ) if ( digit >= 3 && ( neg ? x <= -100 : x >= 100 ) ) if ( digit >= 4 && ( neg ? x <= -1000 : x >= 1000 ) ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _pnc_nochk < 3 >(_table.o + ( neg ? -x : x ) * 4 + 1); else if ( digit >= 2 && ( neg ? x <= -10 : x >= 10 ) ) _pnc_nochk < 2 >(_table.o + ( neg ? -x : x ) * 4 + 2); else _pc_nochk(( neg ? -x : x ) | 48); else { constexpr int cur = 1 << __lg(digit - 1); if ( neg ? x <= -_pw10 < T, cur > : x >= _pw10 < T, cur > ) _write_int_pre < T, neg, digit - cur >(x / _pw10 < T, cur >), _write_int_suf < T, neg, cur >(x % _pw10 < T, cur >); else _write_int_pre < T, neg, cur >(x); } }
	template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void write(T x) { if ( x >= 0 ) _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x); else _pc_nochk(45), _write_int_pre < T, true, numeric_limits < T >::digits10 + 1 >(x); _chk_o(); }
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void write(T x) { _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x), _chk_o(); }
	template < size_t N, class ...T > inline void _read_tuple(tuple < T... > &x) { read(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _read_tuple < N + 1, T... >(x); }
	template < size_t N, class ...T > inline void _write_tuple(const tuple < T... > &x) { write(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _pc(32), _write_tuple < N + 1, T... >(x); }
	template < class ...T > inline void read(tuple < T... > &x) { _read_tuple < 0, T... >(x); }
	template < class ...T > inline void write(const tuple < T... > &x) { _write_tuple < 0, T... >(x); }
	template < class T1, class T2 > inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
	template < class T1, class T2 > inline void write(const pair < T1, T2 > &x) { write(x.first), _pc(32), write(x.second); }
	template < class T > inline auto read(T &x) -> decltype(x.read(), void()) { x.read(); }
	template < class T > inline auto write(const T &x) -> decltype(x.write(), void()) { x.write(); }
	template < class T1, class ...T2 > inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
	template < class ...T > inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
	template < class T1, class ...T2 > inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
	template < class ...T > inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
	template < class T > inline void print(const T &x) { write(x); }
	inline void print_cstr(const char *x) { write_cstr(x); }
	template < class T1, class ...T2 > inline void print(const T1 &x, const T2 &...y) { write(x), _pc(32), print(y...); }
	template < class ...T > inline void print_cstr(const char *x, const T *...y) { write_cstr(x), _pc(32), print_cstr(y...); }
	inline void println() { _pc(10); }
	inline void println_cstr() { _pc(10); }
	template < class ...T > inline void println(const T &...x) { print(x...), _pc(10); }
	template < class ...T > inline void println_cstr(const T *...x) { print_cstr(x...), _pc(10); }
}	using FastIO::read, FastIO::read_cstr, FastIO::write, FastIO::write_cstr, FastIO::println, FastIO::println_cstr;
int n, a[500009], f; ll ans;
inline void work()
{
	read(n), ans = 0;
	For(i, 1, n) read(a[i]);
	For(i, 1, n)
	{
		f = 0;
		For(j, i, n)
		{
			if ( f > a[j] ) break;
			if ( ( a[j] - f ) & 1 ) f++; else f = max(0, f - 1);
			if ( !f ) ans++;
		}
	}
	println(ans);
}
int main() { int t; read(t); For(tt, 1, t) work(); return 0; }
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

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: 0ms
memory: 3800kb

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: 0ms
memory: 3692kb

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: 0ms
memory: 3796kb

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: 3832kb

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: 0ms
memory: 3768kb

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: 1ms
memory: 3844kb

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: 3816kb

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: 3792kb

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: 0ms
memory: 3804kb

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: 3796kb

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: 1ms
memory: 3772kb

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: 1ms
memory: 3776kb

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: 1ms
memory: 3876kb

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: 1ms
memory: 3768kb

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: 2ms
memory: 3832kb

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: 1ms
memory: 3904kb

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: 1ms
memory: 3780kb

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: 1ms
memory: 3860kb

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: 1ms
memory: 3776kb

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: 0ms
memory: 3772kb

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:

1198024088

result:


Subtask #5:

score: 0
Skipped

Dependency #4:

0%