QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#443192#8527. Power Divisionsucup-team896#TL 4244ms580644kbC++2312.9kb2024-06-15 14:43:002024-06-15 14:43:00

Judging History

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

  • [2024-06-15 14:43:00]
  • 评测
  • 测评结果:TL
  • 用时:4244ms
  • 内存:580644kb
  • [2024-06-15 14:43:00]
  • 提交

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2024-06-15 14:23:03]
[Last Modified Time: 2024-06-15 14:42:05] */
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#ifdef LOCAL
#include"debug.h"
#else
#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 DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
	inline char gc() { return getchar(); }
	inline void pc(char c) { putchar(c); }
#else
#ifdef DISABLE_MMAP
	inline constexpr int _READ_SIZE = 1 << 18;
	inline static char _read_buffer[_READ_SIZE], *_read_ptr = nullptr, *_read_ptr_end = nullptr;
	inline char gc()
	{
		if ( __builtin_expect(_read_ptr == _read_ptr_end, false) )
		{
			_read_ptr = _read_buffer, _read_ptr_end = _read_buffer + fread(_read_buffer, 1, _READ_SIZE, stdin);
			if ( __builtin_expect(_read_ptr == _read_ptr_end, false) ) return EOF;
		}
		return *_read_ptr++;
	}
#else
#include<sys/mman.h>
	inline static const char *_read_ptr = (const char *)mmap(nullptr, 0x7fffffff, 1, 2, 0, 0);
	inline char gc() { return *_read_ptr++; }
#endif
	inline constexpr int _WRITE_SIZE = 1 << 18;
	inline static char _write_buffer[_WRITE_SIZE], *_write_ptr = _write_buffer;
	inline void pc(char c)
	{
		*_write_ptr++ = c;
		if ( __builtin_expect(_write_buffer + _WRITE_SIZE == _write_ptr, false) )
			fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer;
	}
	inline struct _auto_flush
	{
		inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); }
	}	_auto_flush;
#endif
	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 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, enable_if_t < _is_signed < T >, int > = 0 >
	inline void read(T &x)
	{
		char c = gc(); bool f = true; x = 0;
		while ( !isdigit(c) ) { if ( c == 45 ) f = false; c = gc(); }
		if ( f ) while ( isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
		else     while ( isdigit(c) ) x = x * 10 - ( c & 15 ), c = gc();
	}
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
	inline void read(T &x)
	{
		char c = gc(); while ( !isdigit(c) ) c = gc();
		x = 0; while ( isdigit(c) ) x = x * 10 + ( c & 15 ), c = gc();
	}
	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, enable_if_t < _is_signed < T >, int > = 0 >
	inline void write(T x)
	{
		char buffer[numeric_limits < T >::digits10 + 1]; int digits = 0;
		if ( x >= 0 )  do buffer[digits++] =  ( x % 10 ) | 48, x /= 10; while ( x );
		else { pc(45); do buffer[digits++] = -( x % 10 ) | 48, x /= 10; while ( x ); }
		while ( digits ) pc(buffer[--digits]);
	}
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 >
	inline void write(T x)
	{
		char buffer[numeric_limits < T >::digits10]; int digits = 0;
		do buffer[digits++] = ( x % 10 ) | 48, x /= 10; while ( x );
		while ( digits ) pc(buffer[--digits]);
	}
	template < int N > struct _tuple_io_helper
	{
		template < class ...T > static inline void _read(tuple < T... > &x) { _tuple_io_helper < N - 1 >::_read(x), read(get<N - 1>(x)); }
		template < class ...T > static inline void _write(const tuple < T... > &x) { _tuple_io_helper < N - 1 >::_write(x), pc(32), write(get<N - 1>(x)); }
	};
	template <> struct _tuple_io_helper < 1 >
	{
		template < class ...T > static inline void _read(tuple < T... > &x) { read(get<0>(x)); }
		template < class ...T > static inline void _write(const tuple < T... > &x) { write(get<0>(x)); }
	};
	template < class ...T > inline void read(tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_read(x); }
	template < class ...T > inline void write(const tuple < T... > &x) { _tuple_io_helper < sizeof...(T) >::_write(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 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 < int P_ > class Modint
{
	using MI = Modint;
	inline Modint(int x, int) : v(x) {}
	inline static int add(int x) { return x < P ? x : x - P; }
	inline static int sub(int x) { return x >= 0 ? x : x + P; }
public:
	static constexpr int P = P_; int v;
	inline Modint() : v(0) {}
	inline Modint(const MI &x) : v(x.v) {}
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 >
	inline Modint(T x) : v(sub(x % P)) {}
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 >
	explicit inline operator T()const { return v; }
	inline friend bool operator==(const MI &x, const MI &y) { return x.v == y.v; }
	inline friend bool operator!=(const MI &x, const MI &y) { return x.v != y.v; }
	inline MI &operator=(const MI &x) { v = x.v; return *this; }
	inline MI &operator++() { v < P - 1 ? v++ : v = 0; return *this; }
	inline MI operator++(int) { MI x = *this; v < P - 1 ? v++ : v = 0; return x; }
	inline MI &operator--() { v ? v-- : v = P - 1; return *this; }
	inline MI operator--(int) { MI x = *this; v ? v-- : v = P - 1; return x; }
	inline MI operator-()const { return MI(v ? P - v : 0, 0); }
	inline friend MI operator+(const MI &x, const MI &y) { return MI(add(x.v + y.v), 0); }
	inline friend MI operator-(const MI &x, const MI &y) { return MI(sub(x.v - y.v), 0); }
	inline friend MI operator*(const MI &x, const MI &y) { return MI((ll)x.v * y.v % P, 0); }
	inline friend MI operator/(const MI &x, const MI &y) { return x * y.inv(); }
	inline MI &operator+=(const MI &x) { v = add(v + x.v); return *this; }
	inline MI &operator-=(const MI &x) { v = sub(v - x.v); return *this; }
	inline MI &operator*=(const MI &x) { v = (ll)v * x.v % P; return *this; }
	inline MI &operator/=(const MI &x) { return *this *= x.inv(); }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 >
	inline MI qpow(T y)const
	{ MI x(*this), z(1, 0); 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 friend MI qpow(const MI &x, T y) { return x.qpow(y); }
	inline MI inv()const { assert(v); return qpow(P - 2); }
	inline friend MI inv(const MI &x) { return x.inv(); }
	inline friend istream &operator>>(istream &is, MI &x) { return is >> x.v; }
	inline friend ostream &operator<<(ostream &os, const MI &x) { return os << x.v; }
};	using MI = Modint < 1000000007 >;
template < ll P_ > class Modlong
{
	using MI = Modlong;
	inline Modlong(ll x, int) : v(x) {}
	inline static ll add(ll x) { return x < P ? x : x - P; }
	inline static ll sub(ll x) { return x >= 0 ? x : x + P; }
	inline static ll mul(ll x, ll y) { return sub(add(x * y - (ll)( 1.l * x * y / P ) * P)); }
public:
	static constexpr ll P = P_; ll v;
	inline Modlong() : v(0) {}
	inline Modlong(const MI &x) : v(x.v) {}
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 >
	inline Modlong(T x) : v(sub(x % P)) {}
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 >
	explicit inline operator T()const { return v; }
	inline friend bool operator==(const MI &x, const MI &y) { return x.v == y.v; }
	inline friend bool operator!=(const MI &x, const MI &y) { return x.v != y.v; }
	inline MI &operator=(const MI &x) { v = x.v; return *this; }
	inline MI &operator++() { v < P - 1 ? v++ : v = 0; return *this; }
	inline MI operator++(int) { MI x = *this; v < P - 1 ? v++ : v = 0; return x; }
	inline MI &operator--() { v ? v-- : v = P - 1; return *this; }
	inline MI operator--(int) { MI x = *this; v ? v-- : v = P - 1; return x; }
	inline MI operator-()const { return MI(v ? P - v : 0, 0); }
	inline friend MI operator+(const MI &x, const MI &y) { return MI(add(x.v + y.v), 0); }
	inline friend MI operator-(const MI &x, const MI &y) { return MI(sub(x.v - y.v), 0); }
	inline friend MI operator*(const MI &x, const MI &y) { return MI(mul(x.v, y.v), 0); }
	inline friend MI operator/(const MI &x, const MI &y) { return x * y.inv(); }
	inline MI &operator+=(const MI &x) { v = add(v + x.v); return *this; }
	inline MI &operator-=(const MI &x) { v = sub(v - x.v); return *this; }
	inline MI &operator*=(const MI &x) { v = mul(v, x.v); return *this; }
	inline MI &operator/=(const MI &x) { return *this *= x.inv(); }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 >
	inline MI qpow(T y)const
	{ MI x(*this), z(1, 0); 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 friend MI qpow(const MI &x, T y) { return x.qpow(y); }
	inline MI inv()const { assert(v); return qpow(P - 2); }
	inline friend MI inv(const MI &x) { return x.inv(); }
	inline friend istream &operator>>(istream &is, MI &x) { return is >> x.v; }
	inline friend ostream &operator<<(ostream &os, const MI &x) { return os << x.v; }
};	using MI_ = Modlong < 1145141919810000037 >;
constexpr int N = 1000018;
int n, a[300009]; MI_ pw[1000029], s[300009], nw; MI dp[300009];
unordered_map < ll, vector < int > > pos;
namespace ST
{
	int f[19][300009];
	inline int cmp(int x, int y) { return a[x] > a[y] ? x : y; }
	inline void init()
	{
		iota(f[0] + 1, f[0] + n + 1, 1);
		For(i, 1, 18) For(j, 1, n + 1 - ( 1 << i )) f[i][j] = cmp(f[i - 1][j], f[i - 1][j + ( 1 << ( i - 1 ) )]);
	}
	inline int qry(int l, int r) { int t = __lg(r - l + 1); return cmp(f[t][l], f[t][r + 1 - ( 1 << t )]); }
}
inline void slv(int l, int r)
{
	if ( l > r ) return;
	int md = ST::qry(l, r);
	slv(l, md - 1);
	For(i, a[md], a[md] + 18)
		if ( md - l <= r - md ) For(j, l, md)
		{
			nw = s[j - 1] + pw[i];
			if ( pos[nw.v].empty() ) continue;
			auto it = lower_bound(pos[nw.v].begin(), pos[nw.v].end(), md);
			if ( it != pos[nw.v].end() && *it <= r ) dp[*it] += dp[j - 1];
		}
		else For(j, md, r)
		{
			nw = s[j] - pw[i];
			if ( pos[nw.v].empty() ) continue;
			auto it = lower_bound(pos[nw.v].begin(), pos[nw.v].end(), md);
			if ( it != pos[nw.v].begin() && *--it >= l - 1 ) dp[j] += dp[*it];
		}
	slv(md + 1, r);
}
int main()
{
	read(n), *pw = 1, pos[0].push_back(0), *dp = 1;
	For(i, 1, N) pw[i] = pw[i - 1] * 2;
	For(i, 1, n) read(a[i]), s[i] = s[i - 1] + pw[a[i]], pos[s[i].v].push_back(i);
	ST::init(), slv(1, n);
	return println(dp[n].v), 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 17952kb

input:

5
2 0 0 1 1

output:

6

result:

ok 1 number(s): "6"

Test #2:

score: 0
Accepted
time: 8ms
memory: 15920kb

input:

1
0

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 8ms
memory: 17880kb

input:

2
1 1

output:

2

result:

ok 1 number(s): "2"

Test #4:

score: 0
Accepted
time: 8ms
memory: 18136kb

input:

3
2 1 1

output:

3

result:

ok 1 number(s): "3"

Test #5:

score: 0
Accepted
time: 12ms
memory: 18188kb

input:

4
3 2 2 3

output:

4

result:

ok 1 number(s): "4"

Test #6:

score: 0
Accepted
time: 12ms
memory: 18336kb

input:

5
3 4 4 2 4

output:

2

result:

ok 1 number(s): "2"

Test #7:

score: 0
Accepted
time: 8ms
memory: 17980kb

input:

7
3 4 3 5 6 3 4

output:

6

result:

ok 1 number(s): "6"

Test #8:

score: 0
Accepted
time: 13ms
memory: 20292kb

input:

10
8 6 5 6 7 8 6 8 9 9

output:

4

result:

ok 1 number(s): "4"

Test #9:

score: 0
Accepted
time: 14ms
memory: 24688kb

input:

96
5 1 0 2 5 5 2 4 2 4 4 2 3 4 0 2 1 4 3 1 2 0 2 2 3 2 4 5 3 5 2 0 2 2 5 3 0 4 5 3 5 4 4 3 1 2 0 5 4 5 0 2 3 2 4 0 0 4 2 0 2 5 3 3 1 5 5 1 1 1 0 5 0 3 0 2 1 1 0 5 0 3 3 4 4 5 3 0 2 2 0 5 4 5 0 5

output:

11332014

result:

ok 1 number(s): "11332014"

Test #10:

score: 0
Accepted
time: 7ms
memory: 24676kb

input:

480
2 0 4 4 1 0 0 3 1 1 4 2 5 5 4 2 1 2 4 4 1 3 4 3 0 5 2 0 2 5 1 0 5 0 0 5 5 0 2 5 2 2 3 1 4 3 5 4 5 2 4 4 4 4 1 4 0 3 4 3 4 1 0 4 3 4 5 4 3 5 0 2 2 0 1 5 4 4 2 0 3 3 3 4 3 0 5 5 3 1 5 1 0 1 0 4 3 0 5 1 4 1 4 3 0 1 3 5 0 3 3 1 0 4 1 1 2 0 1 2 0 3 5 2 0 5 5 5 5 3 5 1 0 2 5 2 2 0 2 0 2 3 5 1 2 1 5 4 ...

output:

506782981

result:

ok 1 number(s): "506782981"

Test #11:

score: 0
Accepted
time: 15ms
memory: 31164kb

input:

2400
0 2 2 0 5 4 3 2 3 2 5 4 5 4 4 5 2 2 4 2 2 0 1 0 5 0 4 4 0 0 5 0 4 0 1 3 4 5 0 3 1 0 4 0 2 5 0 3 3 3 3 1 0 5 5 3 1 3 5 2 4 0 5 0 4 5 4 2 2 1 5 2 2 4 1 0 5 1 5 0 1 2 0 0 3 5 4 0 0 1 1 1 4 2 0 5 1 3 3 5 0 4 4 1 5 5 3 4 4 4 0 2 4 0 5 1 3 1 5 0 5 5 1 3 0 3 1 2 0 1 1 3 5 2 3 4 0 3 0 5 4 0 4 3 5 0 5 2...

output:

586570528

result:

ok 1 number(s): "586570528"

Test #12:

score: 0
Accepted
time: 54ms
memory: 48060kb

input:

12000
2 2 1 2 0 2 5 3 2 0 1 3 2 5 4 0 0 5 3 2 0 2 3 4 3 2 1 4 3 0 3 5 4 1 0 2 4 1 3 2 3 5 0 3 0 0 4 0 4 5 1 0 4 1 1 1 5 4 3 0 3 5 4 5 2 5 0 1 2 3 5 5 2 5 4 2 0 4 4 3 0 0 2 5 0 3 4 2 5 4 2 1 4 5 1 1 2 3 0 3 3 3 3 4 0 5 3 4 0 3 0 2 0 0 2 0 3 4 2 2 0 1 0 5 3 0 2 0 2 2 1 0 5 3 5 4 5 5 0 4 0 4 1 4 4 3 2 ...

output:

201653965

result:

ok 1 number(s): "201653965"

Test #13:

score: 0
Accepted
time: 284ms
memory: 92496kb

input:

60000
2 5 0 3 2 3 5 3 5 5 4 1 1 5 3 0 1 1 2 5 5 5 0 3 2 0 3 2 3 3 0 0 1 4 3 1 4 2 3 3 0 5 1 0 1 1 5 5 4 0 5 4 1 3 1 3 5 3 2 4 4 4 5 4 3 2 3 2 4 5 2 0 4 5 1 2 0 4 0 5 1 3 4 1 2 4 1 1 3 3 0 1 1 3 0 0 2 3 3 2 1 4 1 2 4 3 3 5 2 5 3 4 3 0 2 1 1 1 5 1 2 4 2 3 1 2 1 0 2 0 1 1 5 5 3 4 2 5 2 4 5 3 0 5 1 4 2 ...

output:

592751350

result:

ok 1 number(s): "592751350"

Test #14:

score: 0
Accepted
time: 1462ms
memory: 288808kb

input:

300000
0 5 1 5 5 4 5 3 0 5 0 5 1 4 1 2 2 2 3 0 1 5 4 0 3 1 4 5 2 1 0 3 2 1 2 5 0 2 4 5 0 1 2 1 1 0 0 5 3 0 0 3 4 5 0 2 1 1 1 2 5 1 4 3 1 0 2 0 0 4 3 3 2 5 3 3 1 5 2 0 2 4 3 1 0 3 4 1 3 3 1 0 0 1 1 1 3 1 2 3 5 3 3 2 0 3 0 0 5 5 0 0 0 0 1 4 3 3 4 3 4 5 3 3 5 1 1 4 2 2 1 3 2 1 1 0 0 5 5 0 0 3 2 4 5 5 2...

output:

842503795

result:

ok 1 number(s): "842503795"

Test #15:

score: 0
Accepted
time: 173ms
memory: 117220kb

input:

300000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

432100269

result:

ok 1 number(s): "432100269"

Test #16:

score: 0
Accepted
time: 755ms
memory: 118808kb

input:

300000
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

432100269

result:

ok 1 number(s): "432100269"

Test #17:

score: 0
Accepted
time: 589ms
memory: 121944kb

input:

299995
1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 0...

output:

261818019

result:

ok 1 number(s): "261818019"

Test #18:

score: 0
Accepted
time: 4244ms
memory: 580644kb

input:

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

output:

999738318

result:

ok 1 number(s): "999738318"

Test #19:

score: -100
Time Limit Exceeded

input:

299999
97 34 33 30 15 73 31 69 60 63 79 87 78 13 49 58 23 38 91 28 70 70 14 98 56 59 81 66 29 21 10 51 94 32 41 98 16 48 67 62 55 5 17 81 30 91 39 93 73 74 46 74 41 99 19 10 0 16 72 95 84 40 97 17 76 10 42 50 66 97 4 30 71 74 46 5 75 87 55 82 38 94 14 82 49 10 23 21 19 99 52 100 71 29 64 73 54 88 2 ...

output:


result: