QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#820876#9904. 最小生成树cmk666100 ✓1555ms54196kbC++2316.5kb2024-12-19 09:05:062024-12-19 09:05:07

Judging History

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

  • [2024-12-19 09:05:07]
  • 评测
  • 测评结果:100
  • 用时:1555ms
  • 内存:54196kb
  • [2024-12-19 09:05:06]
  • 提交

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2024-12-19 08:39:10]
[Last Modified Time: 2024-12-19 09:04:57] */
#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;
template < auto P_ > class MontgomeryModInt
{
	using S = decltype(P_); static_assert(is_same_v < S, int > || is_same_v < S, long > || is_same_v < S, long long >);
	static_assert(P_ & 1 && 0 < P_ && P_ < ( (S)1 << ( sizeof(S) * 8 - 2 ) ));
	using U = conditional_t < is_same_v < S, int >, unsigned, unsigned long long >; using D = conditional_t < is_same_v < S, int >, unsigned long long, __uint128_t >;
	inline constexpr static U uinv(U x) { U y = x; for ( int i = is_same_v < S, int > ? 4 : 5 ; i-- ; ) y *= 2 - x * y; return y; }
	constexpr static U P = P_, P2 = P << 1, R = -uinv(P), R2 = -(D)P % P; static_assert(P * R == -1);
	inline constexpr static U reduce(D x) { return ( x + (U)x * R * (D)P ) >> ( sizeof(U) * 8 ); }
	inline constexpr MontgomeryModInt(U x, int) : v(x) {} U v;
public:
	inline constexpr static S mod() { return P; }
	inline constexpr MontgomeryModInt() : v(0) {}
	inline constexpr MontgomeryModInt(const MontgomeryModInt &x) : v(x.v) {}
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt(T x) : v(reduce((D)R2 * ( numeric_limits < T >::is_signed && x < 0 ? ( ( x + P < 0 ) && ( x %= P ), x + P ) : ( ( sizeof(T) > sizeof(U) && x >= (T)1 << sizeof(U) ) && ( x %= P ), x ) ))) {}
	inline constexpr S val()const { U x = reduce(v); return ( x - P ) >> ( sizeof(U) * 8 - 1 ) ? x : x - P; }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > explicit inline constexpr operator T()const { return val(); }
	inline constexpr friend bool operator==(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() == y.val(); }
	inline constexpr friend bool operator!=(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() != y.val(); }
	inline constexpr MontgomeryModInt &operator=(const MontgomeryModInt &x) & { v = x.v; return *this; }
	inline constexpr MontgomeryModInt &operator++() & { return *this += 1; }
	inline constexpr MontgomeryModInt operator++(int) & { MontgomeryModInt x = *this; *this += 1; return x; }
	inline constexpr MontgomeryModInt &operator--() & { return *this -= 1; }
	inline constexpr MontgomeryModInt operator--(int) & { MontgomeryModInt x = *this; *this -= 1; return x; }
	inline constexpr MontgomeryModInt operator-()const { return MontgomeryModInt(v ? P2 - v : 0, 0); }
	inline constexpr MontgomeryModInt &operator+=(const MontgomeryModInt &x) & { v += x.v, ( v - P2 ) >> ( sizeof(U) * 8 - 1 ) || ( v -= P2 ); return *this; }
	inline constexpr MontgomeryModInt &operator-=(const MontgomeryModInt &x) & { v -= x.v, v >> ( sizeof(U) * 8 - 1 ) && ( v += P2 ); return *this; }
	inline constexpr MontgomeryModInt &operator*=(const MontgomeryModInt &x) & { v = reduce((D)v * x.v); return *this; }
	inline constexpr MontgomeryModInt &operator/=(const MontgomeryModInt &x) & { return *this *= x.inv(); }
	inline constexpr friend MontgomeryModInt operator+(MontgomeryModInt x, const MontgomeryModInt &y) { return x += y; }
	inline constexpr friend MontgomeryModInt operator-(MontgomeryModInt x, const MontgomeryModInt &y) { return x -= y; }
	inline constexpr friend MontgomeryModInt operator*(MontgomeryModInt x, const MontgomeryModInt &y) { return x *= y; }
	inline constexpr friend MontgomeryModInt operator/(MontgomeryModInt x, const MontgomeryModInt &y) { return x /= y; }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt qpow(T y)const { MontgomeryModInt x = *this, z = 1; while ( y ) { if ( y & 1 ) z *= x; if ( y >>= 1 ) x *= x; } return z; }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr friend MontgomeryModInt qpow(const MontgomeryModInt &x, T y) { return x.qpow(y); }
	inline constexpr MontgomeryModInt inv()const { return qpow(P - 2); }
	inline constexpr friend MontgomeryModInt inv(const MontgomeryModInt &x) { return x.inv(); }
	inline friend istream &operator>>(istream &is, MontgomeryModInt &x) { S y; is >> y, x = y; return is; }
	inline friend ostream &operator<<(ostream &os, const MontgomeryModInt &x) { return os << x.val(); }
#ifdef USE_FastIO
	inline void read() & { S x; ::read(x), *this = x; }
	inline void write()const { ::write(val()); }
#endif
};	using MI = MontgomeryModInt < 1145141919810000037 >; // 1000000007 1145141919810000037
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
template < class T > inline T R(T l, T r) { return uniform_int_distribution < T >(l, r)(rnd); }
const MI B = MI::mod() / 2 + R(-2333333333ll, 2333333333ll); MI pw[200009];
inline void init_pw(int x) { *pw = 1; For(i, 1, x) pw[i] = pw[i - 1] * B; }
struct info
{
	int l; MI h;
	inline info() {}
	inline info(int l, const MI &h) : l(l), h(h) {}
	inline info operator+(const info &o)const { return info(l + o.l, h * pw[o.l] + o.h); }
	inline bool operator==(const info &o)const { return l == o.l && h == o.h; }
};
namespace ST
{
	struct { info l, r; } t[200009 << 2];
	inline int lc(int p) { return p << 1; }
	inline int rc(int p) { return p << 1 | 1; }
	inline int md(int l, int r) { return ( l + r ) >> 1; }
	inline void pu(int p) { t[p].l = t[lc(p)].l + t[rc(p)].l, t[p].r = t[rc(p)].r + t[lc(p)].r; }
	inline void build(int p, int l, int r)
	{
		if ( l == r ) { t[p].l = t[p].r = info(1, l); return; }
		build(lc(p), l, md(l, r)), build(rc(p), md(l, r) + 1, r), pu(p);
	}
	inline void mdf(int p, int l, int r, int pos, int v)
	{
		if ( l == r ) { t[p].l = t[p].r = info(1, v); return; }
		pos <= md(l, r) ? mdf(lc(p), l, md(l, r), pos, v) : mdf(rc(p), md(l, r) + 1, r, pos, v), pu(p);
	}
	inline info qryl(int p, int l, int r, int lp, int rp)
	{
		if ( l > rp || r < lp ) return info(0, 0);
		if ( lp <= l && r <= rp ) return t[p].l;
		return qryl(lc(p), l, md(l, r), lp, rp) + qryl(rc(p), md(l, r) + 1, r, lp, rp);
	}
	inline info qryr(int p, int l, int r, int lp, int rp)
	{
		if ( l > rp || r < lp ) return info(0, 0);
		if ( lp <= l && r <= rp ) return t[p].r;
		return qryr(rc(p), md(l, r) + 1, r, lp, rp) + qryr(lc(p), l, md(l, r), lp, rp);
	}
}
int n, a[400009], id[400009], bel[200009], pl, pr, o, l, r, md, x, y, tot; ll ans;
vector < int > buc[200009];
int main()
{
	read(n), init_pw(n);
	For(i, 3, n + n - 1) read(a[i]);
	iota(id + 3, id + n + n, 3), sort(id + 3, id + n + n, [&](int x, int y) { return a[x] < a[y]; });
	For(i, 1, n) bel[i] = i, buc[i].push_back(i);
	ST::build(1, 1, n);
	For(i, 3, n + n - 1)
	{
		for ( pl = ( id[i] - 1 ) >> 1, pr = id[i] - pl, o = min(pl, n + 1 - pr), l = 0 ; ; )
		{
			for ( r = o ; l < r ; ) md = ( l + r ) >> 1,
				ST::qryl(1, 1, n, pl - md, pl) == ST::qryr(1, 1, n, pr, pr + md) ? l = md + 1 : r = md;
			if ( l == o ) break;
			x = bel[pl - l], y = bel[pr + l], ans += a[id[i]];
			if ( (int)buc[x].size() < (int)buc[y].size() ) swap(x, y);
			for ( int i : buc[y] ) bel[i] = x, buc[x].push_back(i), ST::mdf(1, 1, n, i, x);
			if ( ++tot == n - 1 ) break;
		}
		if ( tot == n - 1 ) break;
	}
	return println(ans), 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 3ms
memory: 35840kb

input:

1000
345 432 641 771 49 37 930 572 1083 733 1309 1495 818 883 1510 1079 1718 1873 1795 1903 1850 2255 2309 2022 2503 2619 2633 2628 3089 3263 2021 3361 2718 3104 3509 2714 3708 3994 3716 3830 3429 4128 4272 4464 4137 4719 4383 4775 3639 4700 5203 4170 4797 5033 4930 5201 5254 5705 5682 5753 5327 611...

output:

23841384

result:

ok 1 number(s): "23841384"

Test #2:

score: 10
Accepted
time: 5ms
memory: 35964kb

input:

1000
7907859 8299401 2595272 8647244 4654300 116556 9058074 9457856 3976958 11518861 1620710 10332687 19015127 15766719 18789607 17873140 21089373 14170673 12490174 24529096 25019840 25561985 98735 23117075 25603838 24631554 24173505 19647554 31525691 31244267 27972151 24041201 29476743 32211677 381...

output:

245822716951

result:

ok 1 number(s): "245822716951"

Test #3:

score: 10
Accepted
time: 46ms
memory: 36512kb

input:

10000
340635 376047 136654 618815 159696 710061 835001 815618 256229 497032 1343755 1320451 1132380 1539973 1623473 1693936 742042 1524274 1360190 2316919 2412274 1845055 1512219 1892430 2508203 2868404 2749708 2440259 3056384 3057456 3265524 2966678 3189137 3378488 3643366 3679507 3257152 3353380 3...

output:

2486173886938

result:

ok 1 number(s): "2486173886938"

Test #4:

score: 10
Accepted
time: 1555ms
memory: 52848kb

input:

199999
573770324 414266051 954722842 267823478 158683708 565067390 925135266 174993733 436964444 553816220 604600347 779139383 174739126 949957679 854403239 570026878 788469644 953674374 876965030 454165131 744511837 657999668 214085562 499964686 298322155 359355913 174185410 539605497 272107319 335...

output:

1369136336

result:

ok 1 number(s): "1369136336"

Test #5:

score: 10
Accepted
time: 1528ms
memory: 54196kb

input:

199995
915098216 2961244 759529641 482072770 96198925 737065230 449814468 129834835 621735650 54036166 218513119 558467906 677940504 13599685 995819084 510352113 707972383 120352652 589903002 16908544 762512553 739109339 372437660 222576208 513404326 217333429 185120609 391592963 508209737 783114329...

output:

1028748453

result:

ok 1 number(s): "1028748453"

Test #6:

score: 10
Accepted
time: 1239ms
memory: 49508kb

input:

190000
12647 1015 25075 32877 14131 35973 34224 413 44756 46889 54548 54872 63138 61206 71980 85368 66953 33960 95604 43956 100468 110045 110651 72002 125677 123806 133907 140928 103006 130963 143904 169665 170636 165176 183128 175044 182777 187911 196733 199113 207536 212192 226285 232248 234909 21...

output:

42711887507849

result:

ok 1 number(s): "42711887507849"

Test #7:

score: 10
Accepted
time: 1414ms
memory: 50048kb

input:

200000
8109 14228 14749 32990 56681 15919 53325 47174 74650 67783 86459 63058 88143 36203 104344 35793 26382 110478 59803 128301 99948 86098 111738 64341 86847 72244 140370 82851 137577 177720 131119 154285 147726 149828 200941 221507 192221 224332 229763 181710 202066 252618 208158 257523 235035 26...

output:

45006690224362

result:

ok 1 number(s): "45006690224362"

Test #8:

score: 10
Accepted
time: 1518ms
memory: 50084kb

input:

200000
41774 48021 118119 29186 108563 102700 86530 135784 76652 29845 41180 3354 87818 104774 155088 70654 152906 70557 171701 185768 3583 5786 145566 29866 215765 51785 226476 148960 212212 10833 250086 183769 173223 143125 136002 151292 278423 156833 262389 113210 283038 103297 278088 183899 3260...

output:

49872168142307

result:

ok 1 number(s): "49872168142307"

Test #9:

score: 10
Accepted
time: 1428ms
memory: 50248kb

input:

199995
21953 33999 14594 52551 36028 54566 56411 22575 110079 80430 106838 65069 106309 6700 140637 96336 15178 37399 147814 148267 143572 133807 33223 196777 152621 187806 141393 206582 219417 202758 224038 219972 226860 188342 204760 226982 226678 131378 276188 192400 16500 296583 235472 308907 28...

output:

50034940148604

result:

ok 1 number(s): "50034940148604"

Test #10:

score: 10
Accepted
time: 1358ms
memory: 50116kb

input:

199992
15109 10774 19215 25971 19703 9215 31839 29367 42010 30812 43875 31508 40758 64566 22408 68451 60879 61748 29806 78007 76364 88577 52117 73605 106032 86763 127486 99171 117902 139055 167133 87789 107406 157602 160466 182539 183096 172886 187343 195740 175495 199166 125460 167310 209709 203205...

output:

50087500724413

result:

ok 1 number(s): "50087500724413"

Extra Test:

score: 0
Extra Test Passed