QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#768494 | #9615. 骨牌覆盖 | cmk666 | 100 ✓ | 22ms | 11972kb | C++23 | 10.5kb | 2024-11-21 11:18:57 | 2024-11-21 11:18:57 |
Judging History
answer
/* _ _ _ _ __ __ __
/ \ _ _ | |_ | |__ ___ _ __ _ ___ _ __ ___ | | __ / /_ / /_ / /_
/ _ \ | | | | | __| | '_ \ / _ \ | '__| (_) / __| | '_ ` _ \ | |/ / | '_ \ | '_ \ | '_ \
/ ___ \ | |_| | | |_ | | | | | (_) | | | _ | (__ | | | | | | | < | (_) | | (_) | | (_) |
/_/ \_\ \__,_| \__| |_| |_| \___/ |_| (_) \___| |_| |_| |_| |_|\_\ \___/ \___/ \___/
[Created Time: 2024-11-21 10:57:06]
[Last Modified Time: 2024-11-21 11:18:49] */
#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], c0, tg0, tg1; deque < pair < int, int > > mp0, mp1; ll ans;
inline void work()
{
read(n), ans = tg0 = tg1 = 0, mp0.clear(), mp1.clear();
For(i, 1, n) read(a[i]);
For(i, 1, n)
{
if ( mp0.empty() || mp0.front().first + tg0 ) mp0.emplace_front(-tg0, 1);
else mp0.front().second++;
while ( mp0.size() && mp0.back().first + tg0 > a[i] ) mp0.pop_back();
while ( mp1.size() && mp1.back().first + tg1 > a[i] ) mp1.pop_back();
if ( a[i] & 1 ) c0 = 0, tg0++, tg1--;
else
{
if ( mp0.empty() || mp0.front().first + tg0 ) c0 = 0;
else c0 = mp0.front().second, mp0.pop_front();
tg0--, tg1++;
}
swap(mp0, mp1), swap(tg0, tg1);
if ( c0 )
{
if ( mp0.empty() || mp0.front().first + tg0 ) mp0.emplace_front(-tg0, c0);
else mp0.front().second += c0;
}
if ( mp0.size() && !( mp0.front().first + tg0 ) ) ans += mp0.front().second;
}
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: 3692kb
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: 3964kb
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: 3756kb
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: 3900kb
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: 3724kb
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: 3736kb
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: 3992kb
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: 3764kb
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: 3780kb
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: 0ms
memory: 3696kb
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: 3716kb
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: 0ms
memory: 3780kb
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: 3788kb
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: 0ms
memory: 3744kb
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: 0ms
memory: 3988kb
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: 0ms
memory: 4036kb
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: 0ms
memory: 3908kb
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: 0ms
memory: 3736kb
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: 3680kb
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: 3812kb
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: 0ms
memory: 3992kb
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: 3996kb
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: 20
Accepted
Dependency #3:
100%
Accepted
Test #23:
score: 20
Accepted
time: 2ms
memory: 4416kb
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:
ok single line: '1198024088'
Test #24:
score: 20
Accepted
time: 2ms
memory: 4496kb
input:
1 100000 6 5 6 11 14 15 16 17 18 21 22 21 22 27 24 33 31 25 24 29 20 23 44 47 44 49 52 35 38 33 50 56 56 51 62 43 62 61 38 75 64 49 74 81 75 53 76 64 73 80 77 52 75 72 32 49 74 68 71 63 60 74 68 75 66 73 64 85 78 86 79 45 88 87 32 85 70 91 75 90 42 89 92 76 97 62 73 85 92 76 98 73 98 75 84 95 97 88 ...
output:
18433316
result:
ok single line: '18433316'
Test #25:
score: 20
Accepted
time: 2ms
memory: 4348kb
input:
1 100000 5 8 9 10 11 13 7 13 13 13 13 11 9 9 13 11 9 13 13 11 13 13 13 11 9 7 9 11 13 9 13 11 11 11 13 11 10 8 11 14 10 5 11 9 13 11 13 11 11 9 11 13 13 11 11 13 13 13 11 11 9 13 11 3 13 5 9 11 5 13 13 11 13 13 11 9 13 13 11 7 11 9 9 13 11 11 10 12 11 11 9 13 11 13 11 13 12 12 13 13 13 13 11 13 9 9 ...
output:
980702205
result:
ok single line: '980702205'
Test #26:
score: 20
Accepted
time: 2ms
memory: 4504kb
input:
1 100000 5 8 7 10 13 14 11 20 13 16 25 26 15 24 27 34 25 38 39 34 33 46 44 46 47 43 41 48 39 38 47 38 58 44 59 44 55 64 65 66 35 48 53 34 69 60 69 76 73 68 87 66 91 90 85 67 37 93 90 54 87 100 61 72 95 33 109 110 113 98 70 73 112 101 92 89 92 46 88 37 101 54 105 60 73 100 105 106 95 94 67 92 120 52 ...
output:
28408635
result:
ok single line: '28408635'
Test #27:
score: 20
Accepted
time: 2ms
memory: 6056kb
input:
1 100000 0 9 10 8 10 3 7 1 4 7 10 9 5 6 4 7 0 5 6 8 5 1 10 0 10 9 2 1 7 3 8 0 6 10 0 10 1 7 4 0 9 4 7 9 3 0 0 2 7 1 7 6 2 3 10 3 8 2 8 7 8 7 5 2 8 10 0 2 6 7 3 4 4 5 2 10 6 7 2 10 9 8 5 10 7 6 5 3 6 4 5 1 1 3 6 3 2 6 1 8 9 9 8 5 10 3 10 9 1 1 10 6 2 6 8 7 9 5 5 5 9 2 3 3 7 9 5 5 1 6 5 3 1 9 6 2 7 5 ...
output:
455245
result:
ok single line: '455245'
Test #28:
score: 20
Accepted
time: 0ms
memory: 4648kb
input:
1 100000 46 37 1 6 31 23 42 43 50 11 47 5 5 6 8 25 48 12 30 10 37 15 5 34 5 11 42 18 20 13 48 31 8 30 38 24 47 45 39 32 7 18 40 24 43 23 17 18 48 30 48 17 17 46 48 45 49 28 44 22 50 49 39 22 50 18 31 19 4 6 45 36 38 7 41 24 35 42 28 45 18 16 3 10 45 41 4 31 32 46 45 18 22 28 27 33 20 48 48 40 34 2 4...
output:
758145
result:
ok single line: '758145'
Test #29:
score: 20
Accepted
time: 3ms
memory: 4660kb
input:
1 100000 50 41 141 113 86 27 70 108 159 74 73 95 141 75 197 59 5 76 29 196 10 117 184 24 79 7 147 110 35 107 37 57 62 32 21 20 179 81 71 121 138 16 80 172 136 104 7 89 48 184 176 182 80 156 105 45 24 1 31 76 13 186 188 194 17 48 23 145 197 21 87 110 70 156 125 157 36 93 143 62 21 188 49 11 140 136 1...
output:
1162437
result:
ok single line: '1162437'
Test #30:
score: 20
Accepted
time: 2ms
memory: 4508kb
input:
1 100000 353 306 180 155 8 162 259 320 389 76 78 14 237 106 369 330 180 37 52 68 361 182 329 79 287 125 180 398 94 77 207 75 338 92 168 285 284 62 271 43 42 126 218 61 134 44 229 366 306 35 180 382 24 348 43 294 32 99 203 321 54 29 181 6 349 393 373 38 388 356 265 109 93 96 173 293 372 76 76 314 374...
output:
1500164
result:
ok single line: '1500164'
Test #31:
score: 20
Accepted
time: 2ms
memory: 4408kb
input:
1 100000 299 161 102 121 739 257 58 626 286 517 236 275 227 71 477 107 154 197 336 366 5 756 298 499 51 367 45 620 520 459 492 485 154 444 254 609 13 71 88 682 704 485 13 104 78 691 39 300 675 100 731 737 578 215 295 403 430 133 699 234 488 659 193 463 731 291 43 331 110 457 516 721 411 490 569 669 ...
output:
2021908
result:
ok single line: '2021908'
Test #32:
score: 20
Accepted
time: 2ms
memory: 4600kb
input:
1 100000 1 0 1 3 3 3 1 2 5 5 5 4 3 2 6 9 5 2 1 4 7 13 5 2 6 3 10 4 8 0 3 3 0 1 14 9 12 9 15 9 21 16 1 12 10 7 26 12 0 6 1 15 1 12 14 21 29 4 4 31 7 31 5 24 0 15 8 25 16 13 22 13 22 38 12 4 43 2 9 0 1 33 7 47 15 25 25 35 38 34 40 10 27 23 26 23 45 44 46 7 42 38 50 20 2 11 40 44 25 56 40 54 44 53 57 1...
output:
5283320
result:
ok single line: '5283320'
Test #33:
score: 20
Accepted
time: 2ms
memory: 4692kb
input:
1 100000 1 0 0 1 1 1 1 3 2 5 1 0 2 7 0 0 1 3 3 9 9 9 5 1 4 2 6 6 0 4 2 3 7 5 0 4 5 0 4 0 7 14 13 16 0 16 6 6 8 16 0 16 2 9 3 4 10 6 5 11 17 4 5 19 13 23 18 8 18 16 11 14 5 22 8 27 4 13 10 3 21 6 18 26 25 8 12 30 24 7 9 33 18 4 27 2 10 14 6 31 36 25 32 11 43 12 33 19 35 39 2 42 29 40 37 9 44 18 33 24...
output:
5353056
result:
ok single line: '5353056'
Test #34:
score: 20
Accepted
time: 2ms
memory: 4936kb
input:
1 100000 1 0 3 2 1 0 4 2 2 0 7 5 6 7 7 2 7 2 13 3 13 11 2 9 5 2 2 13 4 17 2 7 6 0 21 13 20 5 10 25 1 26 26 24 25 26 23 0 23 4 25 34 5 13 3 24 21 8 24 10 12 7 11 28 25 22 39 26 13 43 31 1 46 7 1 40 35 27 48 23 15 27 13 0 53 46 13 4 7 30 23 20 63 35 34 55 5 44 65 37 45 46 0 16 6 45 1 62 29 49 45 45 50...
output:
3819852
result:
ok single line: '3819852'
Test #35:
score: 20
Accepted
time: 0ms
memory: 4644kb
input:
1 100000 1 0 1 2 3 4 2 2 1 6 7 2 5 3 9 8 0 2 3 0 7 8 6 14 13 8 3 16 10 19 5 5 1 7 5 17 2 5 2 13 21 16 20 11 13 19 12 9 5 5 20 1 14 1 13 14 23 30 31 14 29 3 16 29 37 1 4 11 0 1 14 27 33 38 45 13 40 45 43 20 43 8 38 53 18 7 4 9 49 4 51 20 26 61 45 37 20 17 18 10 44 20 32 27 8 63 19 56 55 53 47 22 52 2...
output:
3617952
result:
ok single line: '3617952'
Test #36:
score: 20
Accepted
time: 0ms
memory: 6072kb
input:
1 100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
2500000000
result:
ok single line: '2500000000'
Test #37:
score: 20
Accepted
time: 3ms
memory: 4604kb
input:
1 100000 1 0 3 0 3 4 7 2 7 6 9 8 5 6 5 14 11 2 1 6 9 4 21 18 15 6 13 24 3 18 25 18 25 22 1 34 5 4 33 0 19 40 29 8 17 18 27 10 3 16 27 44 19 0 35 12 25 36 27 26 59 58 13 58 45 64 9 38 3 4 59 14 55 4 11 66 21 64 77 0 33 40 33 38 5 44 59 32 21 52 3 54 85 50 93 30 93 36 55 16 7 8 1 8 33 102 7 88 7 38 73...
output:
50000
result:
ok single line: '50000'
Subtask #5:
score: 35
Accepted
Dependency #4:
100%
Accepted
Test #38:
score: 35
Accepted
time: 11ms
memory: 7576kb
input:
2 250000 6 7 10 9 10 15 13 15 13 11 11 15 11 15 15 13 13 13 15 13 13 11 11 15 15 15 9 9 15 5 13 11 3 15 15 12 14 11 5 15 15 13 9 13 13 13 13 13 15 13 13 15 13 15 15 13 11 8 12 11 13 9 9 11 13 5 15 13 15 13 13 13 15 12 12 9 15 15 15 15 13 9 5 6 4 13 15 15 15 14 10 13 7 11 15 12 6 12 12 7 15 15 13 8 1...
output:
9440451566 29547652078
result:
ok 2 lines
Test #39:
score: 35
Accepted
time: 7ms
memory: 8476kb
input:
2 500000 3 8 7 10 11 16 17 16 17 24 25 20 21 30 33 30 37 37 33 36 41 24 42 39 39 42 23 44 48 44 33 38 37 42 48 53 48 46 49 45 37 53 35 50 45 50 54 50 53 56 51 49 61 60 57 68 69 48 56 57 67 68 67 70 33 64 73 66 72 63 85 47 38 74 43 78 47 88 85 80 41 64 77 52 69 106 87 84 30 44 73 114 40 83 101 102 11...
output:
277353113 94327747
result:
ok 2 lines
Test #40:
score: 35
Accepted
time: 13ms
memory: 7960kb
input:
5 500000 5 4 5 12 11 10 14 10 14 14 16 10 16 12 12 12 12 12 10 16 12 8 10 10 12 14 14 8 14 8 12 14 14 16 14 11 11 8 14 16 14 12 8 14 8 12 16 13 11 8 16 14 14 14 16 16 14 10 16 14 12 10 14 14 14 13 11 12 16 6 12 8 12 14 8 8 14 14 12 10 12 14 16 10 16 10 14 16 12 8 12 13 13 12 16 14 16 4 14 12 16 9 9 ...
output:
60759413834 1124161325 1176986581 824471450 1359479168
result:
ok 5 lines
Test #41:
score: 35
Accepted
time: 14ms
memory: 9168kb
input:
5 99703 4 7 10 11 12 13 16 19 6 9 20 25 10 31 23 30 28 25 32 19 33 29 20 33 40 30 33 29 28 43 20 43 34 23 22 36 46 43 48 55 62 63 58 45 60 62 63 48 53 25 26 67 64 69 62 59 56 47 53 62 75 28 61 71 65 68 64 45 60 73 40 65 65 52 69 68 46 67 68 45 58 41 64 79 72 91 76 67 73 87 92 93 82 41 56 95 99 98 90...
output:
22097541 23977079 28893033 191502900 27342391
result:
ok 5 lines
Test #42:
score: 35
Accepted
time: 13ms
memory: 6148kb
input:
50 18912 3 6 9 12 8 8 12 10 12 8 12 12 10 9 5 6 6 12 8 7 7 12 12 8 10 5 9 12 12 9 9 10 10 7 9 9 9 12 10 8 6 9 7 9 9 7 9 7 9 5 9 9 9 7 9 9 7 9 5 5 7 9 9 9 9 9 9 7 5 5 9 5 7 5 7 9 9 9 9 5 9 9 9 9 7 9 7 9 7 9 9 7 9 9 9 9 7 7 9 7 9 7 7 9 7 7 9 9 9 9 9 9 9 7 7 7 7 7 9 5 9 7 8 6 7 9 9 9 9 9 9 9 7 5 5 7 9 ...
output:
37778534 57523526 77890530 94496506 79443750 114488647 74994524 56216108 57135676 67710418 60718958 59016623 57352655 44581030 47039163 89026776 101004415 78802307 100788977 110193042 65252962 69128456 95184683 70043281 98653286 95712148 88560566 95645367 54275603 33837900 38882269 89081741 50824222...
result:
ok 50 lines
Test #43:
score: 35
Accepted
time: 14ms
memory: 7664kb
input:
50 18972 5 8 7 8 11 14 15 18 17 24 21 25 21 18 21 30 29 29 33 28 26 34 33 28 41 33 40 22 33 22 39 36 47 23 47 24 51 48 43 56 53 48 57 66 58 60 53 60 23 54 63 66 59 82 67 80 82 71 48 66 81 30 87 54 83 64 79 62 63 89 98 85 55 83 91 98 98 82 95 88 89 55 39 94 107 94 104 95 35 41 100 92 95 109 103 94 98...
output:
2687514 1537677 3032323 1548914 1387348 1361371 1359901 2078043 3087173 1564257 2532947 5081088 1512250 1300698 1778558 1881078 1806910 1164593 1512171 1775914 1511691 1951394 4032283 2623666 1881474 3027210 2102669 1299192 1324272 3161824 2053108 1747183 1642336 1588843 1455728 1881813 1115186 3715...
result:
ok 50 lines
Test #44:
score: 35
Accepted
time: 17ms
memory: 8004kb
input:
10 100000 6 0 1 0 5 6 6 7 0 0 4 4 2 1 8 4 3 2 7 0 4 1 8 7 2 6 6 9 0 9 2 3 5 0 10 3 6 10 8 0 0 4 5 1 10 9 6 0 6 2 10 5 0 2 8 3 3 1 0 10 10 3 10 6 6 3 3 8 6 4 3 3 2 8 8 3 9 1 1 7 10 2 7 7 0 8 8 7 7 8 8 4 5 10 0 3 4 10 5 1 5 8 0 2 2 5 3 5 4 3 0 5 2 5 2 8 5 9 2 4 8 1 10 0 4 10 6 5 6 1 1 3 8 8 1 6 8 3 0 ...
output:
457807 452128 458570 450609 454566 460456 449260 445747 455790 460198
result:
ok 10 lines
Test #45:
score: 35
Accepted
time: 21ms
memory: 7468kb
input:
10 100000 103 67 54 158 164 83 102 87 75 47 161 180 100 107 24 122 40 88 126 8 10 129 138 106 122 144 200 195 64 96 190 28 32 160 25 187 114 86 15 135 21 142 102 18 89 3 98 107 76 188 31 127 152 81 65 57 12 3 185 9 200 97 41 24 37 162 1 88 153 141 165 33 53 64 24 1 96 127 0 36 71 52 49 116 45 86 182...
output:
1186529 1207987 1245517 1193783 1165025 1145003 1208345 1163175 1184749 1175684
result:
ok 10 lines
Test #46:
score: 35
Accepted
time: 19ms
memory: 11548kb
input:
2 500000 1 1 0 3 1 2 3 3 0 0 3 5 3 0 2 0 4 1 2 4 2 7 8 11 1 13 3 0 6 13 11 2 1 4 2 4 8 9 7 3 14 4 3 21 15 10 2 15 13 11 13 18 7 8 2 0 24 13 4 9 27 4 2 31 10 24 0 15 12 1 33 4 28 17 2 33 33 10 3 27 15 31 30 33 13 24 39 22 9 23 42 20 41 40 26 18 17 20 27 3 46 33 0 3 28 56 59 55 6 59 33 2 41 18 17 65 1...
output:
36552786 32950115
result:
ok 2 lines
Test #47:
score: 35
Accepted
time: 17ms
memory: 7976kb
input:
2 500000 1 4 10 1 3 5 1 1 7 2 6 8 1 8 10 0 8 10 0 9 7 10 5 7 10 8 2 4 1 2 4 2 6 8 9 2 10 1 9 1 10 9 3 0 7 8 3 10 3 9 3 4 10 5 9 3 4 6 3 4 6 9 8 9 10 2 1 8 3 8 3 0 1 7 10 5 4 1 4 4 1 4 0 2 2 5 1 4 10 10 2 8 8 3 0 2 3 4 5 3 2 6 10 1 2 0 1 3 6 1 0 2 9 2 1 10 2 1 7 7 3 0 1 1 6 0 10 7 6 4 8 9 8 5 3 5 6 4...
output:
2255145 2243245
result:
ok 2 lines
Test #48:
score: 35
Accepted
time: 18ms
memory: 9008kb
input:
2 500000 117 70 91 182 151 181 20 115 44 17 197 51 182 2 55 137 36 118 40 152 76 169 171 128 7 124 39 148 146 23 84 52 138 159 49 12 146 96 173 180 151 151 47 22 163 46 157 19 172 13 163 36 172 51 138 89 175 117 81 115 8 119 0 5 153 139 85 122 152 96 139 75 16 93 94 185 173 150 38 180 14 108 133 150...
output:
5971833 6012279
result:
ok 2 lines
Test #49:
score: 35
Accepted
time: 19ms
memory: 9616kb
input:
10 100000 1 1 1 0 3 0 3 5 1 1 1 3 0 5 7 3 6 3 1 0 11 1 2 8 0 7 4 0 3 15 10 14 4 6 5 3 1 6 12 17 18 8 7 0 9 12 18 17 18 1 20 20 6 12 5 29 27 11 24 18 5 24 23 17 9 32 10 33 26 2 24 19 18 21 8 19 38 33 31 16 16 4 22 11 32 4 26 44 37 16 36 17 39 0 46 7 44 12 5 53 21 13 20 30 31 51 12 20 17 18 36 11 54 2...
output:
5632048 5768045 5302993 5394706 5661132 5684336 5158827 6540128 5747261 6072885
result:
ok 10 lines
Test #50:
score: 35
Accepted
time: 17ms
memory: 9512kb
input:
10 100000 1 0 1 0 1 5 2 5 5 6 9 4 7 3 2 5 5 0 13 10 10 4 5 8 3 13 2 21 14 3 2 25 10 23 22 21 16 13 20 25 12 4 21 35 1 34 25 8 9 30 15 6 14 25 37 32 24 24 31 7 42 19 44 47 41 5 46 37 48 15 6 25 27 14 27 26 9 10 42 53 12 49 26 39 60 35 3 60 9 48 53 23 12 68 33 6 39 43 7 49 54 32 29 20 33 16 13 54 39 5...
output:
3756567 4044962 4497752 4041973 3938000 4047556 4018796 4431390 3887999 4367998
result:
ok 10 lines
Test #51:
score: 35
Accepted
time: 18ms
memory: 11732kb
input:
2 500000 1 0 1 0 3 2 4 7 2 5 4 7 0 1 8 3 14 7 0 9 6 4 18 21 10 17 3 17 7 9 18 16 1 3 7 8 2 11 14 25 27 18 1 9 20 1 10 6 10 3 17 16 14 30 1 16 19 35 4 17 6 23 27 6 39 29 23 45 4 31 18 46 19 14 40 26 3 8 5 29 32 29 46 27 18 19 55 0 52 59 55 19 12 37 14 6 48 17 48 11 13 26 12 53 22 39 48 39 2 65 56 63 ...
output:
35118001 34894726
result:
ok 2 lines
Test #52:
score: 35
Accepted
time: 17ms
memory: 9504kb
input:
10 100000 1 1 1 0 1 1 1 3 3 0 1 3 3 4 1 0 3 5 4 7 0 4 5 3 2 9 15 14 5 0 14 3 4 4 19 20 5 12 9 22 21 6 17 27 24 5 9 2 17 6 33 35 0 37 2 7 23 17 3 1 36 0 5 35 32 34 35 12 19 30 28 15 16 7 4 15 47 50 39 50 19 44 53 34 47 13 39 45 5 28 31 45 8 59 61 54 36 36 54 0 40 15 19 18 17 52 65 14 51 3 32 0 12 42 ...
output:
4079144 4728233 4240437 3939604 3132282 3784171 3850824 4271699 3649837 4215396
result:
ok 10 lines
Test #53:
score: 35
Accepted
time: 18ms
memory: 11972kb
input:
2 500000 1 0 3 3 2 5 0 1 1 0 5 0 0 6 6 3 8 6 13 6 1 12 3 8 15 16 7 7 0 12 20 17 0 15 18 19 25 22 11 10 27 13 23 26 3 16 23 22 15 26 35 16 29 8 39 33 27 30 23 12 33 8 13 25 35 46 7 28 34 8 21 10 15 11 11 3 10 51 41 2 40 25 42 53 22 40 35 25 22 48 31 46 38 38 36 37 30 39 55 64 23 26 48 7 50 67 0 41 30...
output:
31478152 37365527
result:
ok 2 lines
Test #54:
score: 35
Accepted
time: 21ms
memory: 9612kb
input:
10 100000 1 0 3 2 5 0 7 4 1 0 9 4 11 6 13 10 15 4 3 14 19 16 7 12 21 14 9 10 3 10 13 6 5 20 3 2 21 24 21 12 29 24 39 26 9 36 27 8 37 32 51 6 41 4 11 24 17 10 1 12 15 36 55 32 45 24 59 52 19 66 47 4 35 30 39 26 23 56 65 62 61 54 63 18 59 12 57 30 9 38 69 74 29 38 91 52 69 86 31 32 65 98 97 16 25 54 2...
output:
50000 50000 50000 50000 50000 50000 50000 50000 50000 50000
result:
ok 10 lines
Test #55:
score: 35
Accepted
time: 22ms
memory: 11888kb
input:
2 500000 1 0 1 0 1 0 1 6 3 4 5 8 9 0 11 0 13 14 1 10 21 14 17 6 17 4 3 2 27 16 3 10 17 6 15 26 17 28 31 12 25 22 3 32 15 42 7 42 43 26 35 48 11 16 43 30 33 42 17 6 13 12 57 62 13 4 39 28 17 2 9 20 17 20 19 2 43 52 5 6 57 26 23 66 53 28 69 30 11 48 17 70 85 48 63 66 27 38 71 56 33 4 85 4 69 70 61 34 ...
output:
250000 250000
result:
ok 2 lines
Test #56:
score: 35
Accepted
time: 6ms
memory: 6252kb
input:
10 100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
2500000000 2500000000 2500000000 2500000000 2500000000 2500000000 2500000000 2500000000 2500000000 2500000000
result:
ok 10 lines
Test #57:
score: 35
Accepted
time: 11ms
memory: 7928kb
input:
2 500000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
62500000000 62500000000
result:
ok 2 lines