QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#842427#9962. Diminishing Fractionsucup-team896#TL 1576ms51028kbC++2012.5kb2025-01-04 12:48:372025-01-04 12:48:37

Judging History

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

  • [2025-01-04 12:48:37]
  • 评测
  • 测评结果:TL
  • 用时:1576ms
  • 内存:51028kb
  • [2025-01-04 12:48:37]
  • 提交

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2025-01-04 10:13:03]
[Last Modified Time: 2025-01-04 12:48:28] */
#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;
struct barrett
{
	int p; __uint128_t b;
	inline void init(int x) { p = x, b = ( (__uint128_t)1 << 64 ) / p; }
	template < class T > inline int reduce(T x)const
	{ return x -= p * (T)( ( x * b ) >> 64 ), x < p ? x : x - p; }
	template < class T > inline int div_reduce(T x, T &y)const
	{ return y = ( x * b ) >> 64, x -= p * y, x < p ? x : ( y++, x - p ); }
};
inline int exgcd(int a, int b, int &x, int &y)
{
	if ( !b ) return x = 1, y = 0, a;
	int d = exgcd(b, a % b, y, x); return y -= a / b * x, d;
}
struct I
{
	using ull = unsigned long long;
	ull vec[1150]; int len;
	inline I &operator=(const I &x) { return len = x.len, memcpy(vec, x.vec, len << 3), *this; }
	inline void fix() { while ( !vec[len - 1] ) len--; }
	inline I &operator=(int x) { return vec[0] = x, len = 1, *this; }
	inline I &operator*=(int x)
	{
		ull z = 0; __uint128_t o;
		For(i, 0, len - 1) o = z + (__uint128_t)vec[i] * x, z = o >> 63, vec[i] = o & ( ( 1ull << 63 ) - 1 );
		if ( z ) vec[len++] = z;
		return *this;
	}
	inline bool operator<(const I &x)const
	{
		if ( len != x.len ) return len < x.len;
		Fol(i, len - 1, 0) if ( vec[i] != x.vec[i] ) return vec[i] < x.vec[i];
		return false;
	}
	inline I &operator-=(const I &x)
	{
		For(i, 0, x.len - 1) if ( ( vec[i] -= x.vec[i] ) >> 63 ) vec[i] += 1ull << 63, vec[i + 1]--;
		For(i, x.len, len - 1) if ( vec[i] >> 63 ) vec[i] += 1ull << 63, vec[i + 1]--; else break;
		return *this;
	}
	inline int operator%(const barrett &x)const
	{
		int z = 0, co = x.reduce(1ull << 63);
		Fol(i, len - 1, 0) z = x.reduce((ull)z * co + vec[i]);
		return z;
	}
	inline I &operator/=(const barrett &x)
	{
		ull o, ad; int z = 0, co = x.div_reduce(1ull << 63, o);
		Fol(i, len - 1, 0) ad = z * o, z = x.div_reduce((ull)z * co + vec[i], vec[i]), vec[i] += ad;
		return *this;
	}
};
constexpr int N = 50000;
bool pr[50009]; int bs[50009];
inline void init()
{
	For(i, 2, N) if ( !pr[i] )
	{
		for ( ll j = i ; j <= N ; j *= i ) bs[j] = i;
		for ( int j = i << 1 ; j <= N ; j += i ) pr[j] = true;
	}
}
int n, len, cur[5209], k, o, x, y, nw; barrett qwq; bool used[50009], flg; I prod[5209], res[2];
inline void work()
{
	read(n);
	if ( n < 3 ) { write("1/"s, n, '\n'); return; }
	fill(used + 1, used + n + 1, false), len = 0;
	Fol(i, n, 2) if ( bs[i] && !used[bs[i]] ) used[bs[i]] = true, cur[++len] = i;
	res[0] = prod[len + 1] = 1, flg = false; Fol(i, len, 2) ( prod[i] = prod[i + 1] ) *= cur[i];
	For(i, 1, len - 1)
	{
		qwq.init(cur[i]), k = res[flg] % qwq, o = prod[i + 1] % qwq, exgcd(cur[i], o, x, y);
		y = qwq.reduce((ll)( y + cur[i] ) * k), ( res[!flg] = prod[i + 1] ) *= y;
		if ( flg ) write('-'); else if ( i != 1 ) write('+'); write(y, '/', cur[i]);
		if ( res[flg] < res[!flg] ) flg = !flg;
		( res[flg] -= res[!flg] ) /= qwq, res[flg].fix();
	}
	write(flg ? '-' : '+', res[flg].vec[0], '/', cur[len], '\n');
}
int main() { int t; init(), read(t); For(tt, 1, t) work(); return cerr << clock() << endl, 0; }
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4272kb

input:

2
3
6

output:

2/3-1/2
3/5-1/4-1/3

result:

ok OK, t = 2

Test #2:

score: 0
Accepted
time: 1ms
memory: 3980kb

input:

1
1

output:

1/1

result:

ok OK, t = 1

Test #3:

score: 0
Accepted
time: 1ms
memory: 3984kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1/1
1/2
2/3-1/2
3/4-2/3
3/5-1/4-1/3
3/5-1/4-1/3
2/7-1/5-3/4+2/3
1/8-6/7+2/5+1/3
1/9-5/8+5/7-1/5
1/9-5/8+5/7-1/5

result:

ok OK, t = 10

Test #4:

score: 0
Accepted
time: 1ms
memory: 4396kb

input:

54
7
20
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
3
47
81

output:

2/7-1/5-3/4+2/3
15/19-5/17-1/16-9/13+9/11-4/9-5/7+3/5
1/2
2/3-1/2
3/4-2/3
3/5-1/4-1/3
3/5-1/4-1/3
2/7-1/5-3/4+2/3
1/8-6/7+2/5+1/3
1/9-5/8+5/7-1/5
1/9-5/8+5/7-1/5
1/11-4/9+1/8+3/7-1/5
1/11-4/9+1/8+3/7-1/5
10/13-5/11-1/9-3/8+4/7-2/5
10/13-5/11-1/9-3/8+4/7-2/5
10/13-5/11-1/9-3/8+4/7-2/5
13/16-8/13-8/11...

result:

ok OK, t = 54

Test #5:

score: 0
Accepted
time: 0ms
memory: 6340kb

input:

92
51
54
57
60
63
66
69
72
75
78
81
84
87
90
93
96
99
102
105
108
111
114
117
120
123
126
129
132
135
138
141
144
147
150
153
156
159
162
165
168
171
174
177
180
183
186
189
192
195
198
201
204
207
210
213
216
219
222
225
228
231
234
237
240
243
246
249
252
255
258
261
264
267
270
273
276
279
282
28...

output:

26/49-26/47+30/43-15/41-16/37+27/32-13/31-5/29-25/27+21/25-4/23+8/19-6/17+2/13-1/11
11/53-18/49+27/47-40/43+9/41+36/37-17/32-2/31-28/29+25/27-18/25+6/23+17/19-3/17-11/13+6/11
11/53-18/49+27/47-40/43+9/41+36/37-17/32-2/31-28/29+25/27-18/25+6/23+17/19-3/17-11/13+6/11
45/59-7/53-41/49+14/47-24/43+21/41...

result:

ok OK, t = 92

Test #6:

score: 0
Accepted
time: 22ms
memory: 4956kb

input:

1000
622
149
839
472
292
345
799
941
449
15
907
494
48
430
505
66
83
97
10
548
286
644
528
249
573
860
557
932
746
262
971
157
603
715
984
333
53
916
784
649
70
768
780
64
118
616
979
466
24
2
517
774
566
419
182
222
40
169
951
830
977
383
355
770
134
973
917
3
854
31
35
825
109
945
671
536
952
888
...

output:

429/619-65/617-564/613+63/607+69/601+398/599-48/593-473/587+425/577-551/571+348/569-303/563+496/557-391/547+508/541-174/529-358/523+434/521-343/512+448/509-324/503-159/499+156/491-375/487+454/479-465/467+148/463+389/461-449/457+372/449-406/443+163/439+222/433-272/431+88/421+379/419-75/409-252/401+37...

result:

ok OK, t = 1000

Test #7:

score: 0
Accepted
time: 113ms
memory: 8608kb

input:

1000
1748
1741
1576
1940
1648
1825
1183
1447
1318
1277
1913
1208
1417
1388
1143
1581
1222
1904
1407
1006
1175
1218
1734
1934
1003
1704
1984
1399
1333
1840
1317
1233
1133
1232
1776
1881
1476
1712
1401
1231
1978
1964
1419
1644
1103
1498
1454
1480
1377
1352
1837
1616
1009
1413
1199
1977
1477
1579
1920
...

output:

493/1747-1275/1741+226/1733+788/1723-947/1721+302/1709+889/1699-163/1697-741/1693+958/1681-1128/1669+1511/1667-1317/1663+1063/1657-753/1637+739/1627-1171/1621+879/1619-594/1613+709/1609-1327/1607+1087/1601-286/1597+1081/1583-456/1579-1498/1571+127/1567+273/1559+1489/1553-1377/1549+196/1543+1454/1531...

result:

ok OK, t = 1000

Test #8:

score: 0
Accepted
time: 269ms
memory: 8468kb

input:

1000
2107
2115
2985
2832
2564
2529
2971
2637
2666
2172
2496
2191
2465
2199
2260
2161
2402
2369
2762
2674
2734
2252
2488
2185
2652
2014
2018
2960
2313
2063
2696
2976
2457
2247
2180
2647
2907
2901
2912
2538
2512
2623
2267
2986
2348
2170
2131
2166
2563
2111
2860
2254
2462
2080
2054
2803
2397
2778
2411
...

output:

1387/2099-259/2089-720/2087-231/2083-101/2081-701/2069+12/2063+118/2053+85/2048+698/2039-1659/2029+554/2027+257/2017+430/2011+243/2003-1422/1999+1183/1997+565/1993-217/1987-37/1979-1512/1973+1151/1951+644/1949-1009/1933+1419/1931-1450/1913+1672/1907-997/1901-89/1889-1657/1879+1341/1877+903/1873-1141...

result:

ok OK, t = 1000

Test #9:

score: 0
Accepted
time: 482ms
memory: 9380kb

input:

1000
3416
3784
3793
3610
3982
3174
3253
3088
3197
3926
3664
3669
3431
3821
3340
3298
3498
3627
3194
3354
3362
3512
3865
3529
3988
3973
3852
3552
3672
3282
3035
3639
3998
3090
3771
3618
3402
3139
3903
3110
3452
3947
3941
3225
3187
3283
3243
3722
3808
3491
3309
3935
3937
3259
3909
3665
3809
3390
3285
...

output:

1959/3413-1068/3407-1454/3391+1614/3389-1781/3373+2094/3371-642/3361-927/3359+2101/3347-1521/3343-1365/3331+1297/3329-2327/3323+1742/3319+425/3313-1055/3307+807/3301+867/3299-345/3271-2917/3259+1329/3257+1382/3253-1229/3251+2385/3229-726/3221-2196/3217+2026/3209-2100/3203+2119/3191-1263/3187+1916/31...

result:

ok OK, t = 1000

Test #10:

score: 0
Accepted
time: 660ms
memory: 10976kb

input:

899
4695
4616
4545
4771
4315
4850
4821
4722
4493
4338
4566
4144
4721
4334
4536
4313
4264
4669
4648
4780
4551
4044
4506
4798
4483
4372
4371
4636
4650
4590
4340
4383
4756
4104
4077
4067
4692
4008
4141
4610
4532
4751
4345
4498
4214
4621
4519
4505
4681
4726
4011
4879
4103
4283
4470
4844
4520
4740
4333
4...

output:

2300/4691-3933/4679+2864/4673-104/4663-2178/4657+3859/4651-3580/4649+1633/4643-4599/4639+589/4637+4512/4621-1065/4603-4546/4597+656/4591+52/4583+3955/4567-3330/4561+3890/4549-1472/4547+2130/4523-2347/4519+391/4517+109/4513+2604/4507-3406/4493+2220/4489-1752/4483+1891/4481-1601/4463+2178/4457-3140/44...

result:

ok OK, t = 899

Test #11:

score: 0
Accepted
time: 658ms
memory: 51028kb

input:

1000
3798
4097
3356
3197
4364
3360
3927
4704
4072
3229
3681
3276
4187
4013
4014
3134
3743
3208
4792
3235
4788
3953
3313
4147
3230
3497
3181
4376
4631
3710
3602
4191
3405
3381
4722
3607
4374
3037
3149
3682
3557
3338
4471
3242
4470
4753
4637
3343
3625
4516
3505
3553
3626
3073
3222
4514
4402
4063
3372
...

output:

1071/3797-2795/3793+612/3779+3462/3769-2937/3767+1771/3761-1057/3739-776/3733+1357/3727-935/3721+3339/3719-2903/3709-3267/3701+1817/3697+595/3691+652/3677-922/3673+202/3671+2909/3659-2230/3643+3114/3637-2879/3631-475/3623+1170/3617-2680/3613+3525/3607-405/3593-3150/3583+1055/3581+1449/3571-330/3559-...

result:

ok OK, t = 1000

Test #12:

score: 0
Accepted
time: 1576ms
memory: 50380kb

input:

474
7545
5913
9012
7937
9033
8958
6042
9802
6773
7104
7992
7475
7128
5208
6469
5645
7483
49664
7929
9114
8828
7916
9405
6829
8448
8454
9204
7795
5960
6310
9545
49393
8789
5482
8149
7405
8428
7210
5902
8761
5209
8251
7599
9264
5237
8710
6878
8842
5430
9871
8230
8959
9001
8926
9201
5003
8737
7628
7133...

output:

1062/7541-5652/7537+3477/7529+2131/7523-545/7517-5249/7507+960/7499+3048/7489+587/7487+1130/7481-240/7477-40/7459-987/7457+6234/7451-1974/7433-1373/7417-5243/7411+5279/7393-5905/7369+6215/7351-1663/7349-5173/7333+2154/7331+2113/7321-95/7309-5121/7307+2247/7297+5534/7283-1403/7253-5561/7247+3299/7243...

result:

ok OK, t = 474

Test #13:

score: -100
Time Limit Exceeded

input:

505
654
4006
658
39050
749
2525
45144
8
107
366
181
1161
49410
315
24
1125
56
2895
4689
19600
861
18
17643
27130
4321
20973
43326
5761
3127
514
4286
286
55
4733
1114
1022
540
15500
47
158
2168
529
428
41729
1778
83
53
904
416
25550
134
475
2624
386
13073
4799
16
484
27746
7
35604
37
1814
1384
45
377...

output:

205/653-239/647+255/643-82/641-628/631+149/625+92/619+415/617-211/613+463/607-137/601-426/599+154/593-356/587+452/577-99/571-67/569+1/563+515/557-30/547-524/541+74/529+3/523+390/521-413/512+63/509-312/503+72/499+72/491+290/487-404/479+214/467+8/463+421/461-155/457-101/449-415/443+106/439+152/433+328...

result: