QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#788502 | #9605. 新生舞会 | cmk666 | 100 ✓ | 23ms | 41892kb | C++23 | 9.9kb | 2024-11-27 17:13:00 | 2024-11-27 17:13:07 |
Judging History
answer
/* _ _ _ _ __ __ __
/ \ _ _ | |_ | |__ ___ _ __ _ ___ _ __ ___ | | __ / /_ / /_ / /_
/ _ \ | | | | | __| | '_ \ / _ \ | '__| (_) / __| | '_ ` _ \ | |/ / | '_ \ | '_ \ | '_ \
/ ___ \ | |_| | | |_ | | | | | (_) | | | _ | (__ | | | | | | | < | (_) | | (_) | | (_) |
/_/ \_\ \__,_| \__| |_| |_| \___/ |_| (_) \___| |_| |_| |_| |_|\_\ \___/ \___/ \___/
[Created Time: 2024-11-27 16:49:42]
[Last Modified Time: 2024-11-27 17:12:55] */
#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, fa[2000009], f[2000009], g[2000009], o, ans;
inline void work()
{
read(n), fill(f + 1, f + n + 1, 0), fill(g + 1, g + n + 1, 0);
For(i, 2, n) read(fa[i]);
Fol(i, n, 1)
o = ~g[i] & -~g[i], f[i] &= ~( o - 1 ), f[i] |= o, g[i] ^= ( o << 1 ) - 1,
f[fa[i]] ^= f[i], g[fa[i]] |= g[i];
ans ^= f[1];
}
int main() { int t; read(t); For(tt, 1, t) work(); return println(ans), 0; }
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 7960kb
input:
12 13 1 2 1 4 2 5 3 3 2 9 6 4 392 1 2 2 4 4 3 3 6 9 10 9 11 13 14 15 15 17 18 19 20 6 21 23 12 24 26 27 28 29 30 31 32 33 31 34 33 36 9 38 40 41 25 42 44 45 46 47 48 49 50 51 52 53 21 32 52 54 58 59 60 53 61 63 64 65 66 67 68 69 70 4 1 71 74 75 76 77 78 79 80 81 52 82 55 84 86 84 87 89 90 91 92 93 1...
output:
1875
result:
ok 1 number(s): "1875"
Test #2:
score: 10
Accepted
time: 0ms
memory: 7828kb
input:
1 5000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 21 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 79 85 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
output:
4950
result:
ok 1 number(s): "4950"
Test #3:
score: 10
Accepted
time: 1ms
memory: 7820kb
input:
1 5000 1 1 2 1 2 2 3 4 9 10 9 12 13 10 15 12 14 14 18 20 19 22 19 20 21 24 26 27 25 30 30 32 33 33 33 32 34 35 38 40 39 38 40 43 43 44 43 46 48 50 50 48 50 53 53 52 56 56 57 56 57 60 61 61 61 62 66 65 69 67 71 70 71 73 75 73 73 75 78 80 78 80 82 80 82 84 86 85 89 86 87 92 92 92 95 94 95 95 95 100 10...
output:
3204
result:
ok 1 number(s): "3204"
Subtask #2:
score: 10
Accepted
Test #4:
score: 10
Accepted
time: 20ms
memory: 28068kb
input:
15 1 5 1 1 3 3 10603 1 2 2 1 5 3 6 3 2 7 6 6 10 5 4 16 4 16 18 4 11 22 8 14 2 26 22 9 10 20 28 26 1 27 8 35 3 4 6 25 14 9 33 44 15 26 28 34 24 18 48 5 33 11 37 32 19 14 41 6 46 60 8 25 62 32 59 27 54 50 62 44 51 18 53 46 42 31 26 11 78 71 40 60 2 13 35 84 34 76 51 88 33 13 88 85 80 70 21 74 54 79 75...
output:
11527
result:
ok 1 number(s): "11527"
Test #5:
score: 10
Accepted
time: 23ms
memory: 40688kb
input:
1 2000000 1 1 1 4 5 5 3 6 4 1 11 2 11 4 15 11 11 11 1 16 11 15 22 6 7 23 4 5 8 2 27 1 5 3 15 30 30 21 34 28 22 24 25 33 45 13 1 46 27 27 39 15 42 44 38 27 52 39 27 58 36 37 29 34 30 44 29 55 17 60 34 30 61 29 61 13 12 67 70 9 67 40 54 72 14 80 42 27 49 88 12 2 53 8 57 93 74 22 22 85 61 79 89 55 23 1...
output:
16384
result:
ok 1 number(s): "16384"
Subtask #3:
score: 30
Accepted
Dependency #1:
100%
Accepted
Test #6:
score: 30
Accepted
time: 0ms
memory: 9164kb
input:
16 4 1 1 3 9 1 2 3 4 5 6 7 8 58 1 2 2 4 5 6 7 8 9 2 10 12 13 5 8 14 17 4 18 20 21 22 8 10 4 23 27 5 26 21 20 28 26 33 35 36 37 38 22 39 41 42 43 44 34 45 47 3 31 48 51 52 53 54 44 44 21 30 1 2 1 4 5 2 6 8 8 2 11 5 9 13 10 16 17 18 12 10 11 19 12 23 23 3 16 26 29 36 1 1 1 2 2 1 2 3 1 10 6 3 12 3 8 9 ...
output:
20841
result:
ok 1 number(s): "20841"
Test #7:
score: 30
Accepted
time: 2ms
memory: 9872kb
input:
1 200000 1 2 3 4 5 6 7 7 9 10 11 12 13 14 15 13 16 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...
output:
195053
result:
ok 1 number(s): "195053"
Test #8:
score: 30
Accepted
time: 2ms
memory: 11924kb
input:
1 200000 1 1 2 2 2 4 4 4 6 10 9 10 11 12 13 15 15 18 19 19 19 20 20 22 23 23 23 24 26 27 28 28 29 34 31 35 33 37 35 40 37 39 43 43 43 46 46 48 48 50 48 52 49 50 53 54 54 56 57 56 61 60 59 60 61 65 64 64 65 69 70 72 73 74 72 73 75 78 76 77 80 79 80 81 81 82 86 84 87 90 88 91 93 93 94 94 94 97 95 100 ...
output:
127754
result:
ok 1 number(s): "127754"
Test #9:
score: 30
Accepted
time: 2ms
memory: 10876kb
input:
1 200000 1 2 3 4 1 3 4 4 4 1 3 2 3 3 3 5 2 1 4 5 4 3 5 3 3 2 2 1 1 2 4 2 4 3 3 1 1 2 4 5 5 5 5 2 1 5 3 4 1 5 2 3 4 5 2 3 3 3 1 2 4 2 2 1 1 2 4 1 3 4 1 4 3 4 4 2 1 4 4 5 1 2 1 1 3 2 4 3 3 3 1 2 3 4 3 1 5 5 2 3 2 2 4 2 2 5 2 2 3 5 1 2 2 1 5 5 3 4 2 1 2 5 3 4 5 5 4 5 1 5 3 3 4 3 5 5 4 2 5 5 2 2 3 3 4 2...
output:
10
result:
ok 1 number(s): "10"
Test #10:
score: 30
Accepted
time: 2ms
memory: 11752kb
input:
1 200000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 ...
output:
66
result:
ok 1 number(s): "66"
Test #11:
score: 30
Accepted
time: 0ms
memory: 13440kb
input:
1 200000 1 2 2 1 5 3 2 7 4 1 5 10 2 3 15 16 13 1 12 13 19 13 19 16 23 9 10 1 23 26 30 7 25 16 25 36 16 27 10 39 40 20 6 5 30 3 46 41 35 30 24 28 28 8 38 25 32 38 29 21 56 17 24 38 5 7 62 58 13 8 11 45 47 55 55 12 64 8 55 7 5 31 73 20 85 83 44 74 58 65 57 66 27 47 66 56 90 39 96 15 37 14 30 61 96 73 ...
output:
8192
result:
ok 1 number(s): "8192"
Test #12:
score: 30
Accepted
time: 2ms
memory: 11940kb
input:
1 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 25 62 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...
output:
199948
result:
ok 1 number(s): "199948"
Subtask #4:
score: 50
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #13:
score: 50
Accepted
time: 12ms
memory: 38208kb
input:
13 397 1 2 3 1 4 4 6 2 8 10 11 12 13 5 14 16 17 18 19 20 17 21 7 23 25 26 18 16 22 11 27 18 28 32 35 36 17 37 39 40 28 17 41 23 44 16 13 13 46 50 51 16 16 52 55 56 21 57 59 38 28 9 18 60 65 22 66 68 69 70 71 72 73 9 74 76 77 78 79 80 81 25 82 84 25 85 87 88 51 89 91 87 92 94 95 42 96 98 59 99 101 10...
output:
523799
result:
ok 1 number(s): "523799"
Test #14:
score: 50
Accepted
time: 16ms
memory: 41728kb
input:
1 2000000 1 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 21 23 24 25 26 27 28 29 30 31 32 33 19 34 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 44 62 64 65 63 66 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 14 20 88 91 92 93 94 95 96 97 98 99 100...
output:
1949728
result:
ok 1 number(s): "1949728"
Test #15:
score: 50
Accepted
time: 7ms
memory: 41892kb
input:
1 2000000 1 2 1 4 3 4 5 6 6 10 11 8 9 10 11 13 16 15 18 16 19 19 22 20 23 23 24 28 28 30 29 28 30 33 33 35 33 34 37 36 37 39 41 42 41 44 44 47 45 47 50 49 49 52 53 52 54 55 56 60 60 60 60 62 64 63 64 68 66 67 70 70 71 72 73 74 76 74 79 79 78 82 80 80 83 86 84 86 85 87 88 90 91 93 94 93 94 95 96 97 9...
output:
1283040
result:
ok 1 number(s): "1283040"
Test #16:
score: 50
Accepted
time: 4ms
memory: 40632kb
input:
1 2000000 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52...
output:
93
result:
ok 1 number(s): "93"
Test #17:
score: 50
Accepted
time: 18ms
memory: 40620kb
input:
1 2000000 1 2 1 4 3 4 1 3 5 6 4 8 3 5 9 14 14 3 5 3 5 22 1 6 22 14 26 13 13 5 4 24 32 14 13 30 3 14 4 21 30 15 5 33 27 35 19 19 39 14 42 21 11 19 15 1 52 5 56 45 10 60 5 42 40 31 11 38 63 18 51 63 49 70 54 11 24 31 58 49 24 12 33 39 2 34 59 69 85 18 10 25 37 56 93 84 40 1 80 38 53 48 33 51 96 76 13 ...
output:
16384
result:
ok 1 number(s): "16384"
Test #18:
score: 50
Accepted
time: 3ms
memory: 31148kb
input:
1 2000000 1 1 3 4 5 1 4 1 2 3 1 1 2 5 4 5 5 3 5 3 3 1 2 5 5 4 2 4 5 1 4 1 3 4 5 2 3 2 5 1 5 3 2 4 4 4 1 4 2 4 3 2 5 3 5 1 4 3 2 4 4 1 3 4 3 4 3 5 5 1 4 1 4 5 5 1 2 3 1 3 3 5 2 5 4 5 2 5 3 4 3 1 4 4 3 3 2 5 1 5 1 4 2 2 5 3 4 1 4 4 4 5 1 3 4 4 5 1 5 4 2 1 2 3 4 1 3 4 2 4 1 3 1 5 4 4 3 5 2 2 1 1 5 3 4 ...
output:
8
result:
ok 1 number(s): "8"
Test #19:
score: 50
Accepted
time: 17ms
memory: 41804kb
input:
1 2000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10...
output:
1999540
result:
ok 1 number(s): "1999540"
Test #20:
score: 50
Accepted
time: 23ms
memory: 40800kb
input:
1 2000000 1 2 2 1 5 5 2 7 1 10 9 10 3 7 8 9 1 5 6 19 15 22 16 20 3 17 25 18 24 18 26 14 32 4 18 30 25 16 6 28 41 15 3 41 32 27 7 47 14 19 36 14 24 32 10 20 24 34 25 56 34 46 21 41 63 57 46 58 64 20 3 32 59 45 5 47 16 31 24 26 34 35 69 41 66 69 55 81 63 10 17 1 87 52 46 25 56 7 49 57 88 8 83 67 101 6...
output:
245760
result:
ok 1 number(s): "245760"