QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239056#7681. Prefix MahjongBan Genshin Impact (Mofei Zhou, Mixuan Zhang, Xiangyu Zhu)#AC ✓81ms47516kbC++143.2kb2023-11-04 18:17:122023-11-04 18:17:13

Judging History

This is the latest submission verdict.

  • [2023-11-04 18:17:13]
  • Judged
  • Verdict: AC
  • Time: 81ms
  • Memory: 47516kb
  • [2023-11-04 18:17:12]
  • Submitted

answer

/*
60 + 0 + 100 + 64 = 224.
*/

#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define L(i, j, k) for (int i = (j); i <= (k); i++)
#define R(i, j, k) for (int i = (j); i >= (k); i--)
#define pb push_back
#define pii pair<int, int>
inline int read()
{
	int sum = 0, nega = 1;
	char ch = getchar();
	while (ch > '9'||ch < '0')
	{
	    if (ch == '-') nega = -1;
		ch = getchar();
	}
	while (ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
	return sum * nega;
}
const int N = 3e5 + 9, mod = 998244353;
inline void add(int &x, int y) {x = (x + y) % mod;}
inline void del(int &x, int y) {x = (x - y + mod) % mod;}
int id[N];
struct node
{
	int A[9][2];
}tr[N << 2];
inline int lowbit(int x) {return x & (-x);}
inline void init()
{
	L(i, 0, 8) id[(1 << i)] = i; return ;
}
inline void Clear(node &x)
{
	L(i, 0, 8) x.A[i][0] = x.A[i][1] = 0; return ;
}
inline node Merge(node x, node y)
{
	int t, ff;
	node z; Clear(z);
	L(i, 0, 8)
	{
		t = x.A[i][0];
	//	if(t) cout << t << "awa" << endl;
		while(t) ff = lowbit(t), z.A[i][0] |= y.A[id[ff]][0], z.A[i][1] |= y.A[id[ff]][1], t -= ff;
	}
	L(i, 0, 8)
	{
		t = x.A[i][1];
		while(t) ff = lowbit(t), z.A[i][1] |= y.A[id[ff]][0], t -= lowbit(t);
	}
	return z;
}
inline int d(int x, int y) {return x * 3 + y;}
int n, a[N], cnt[N], b[N], tot, t[N], m;
inline void Set(int p, int x)
{
	node z; Clear(z); int cn = cnt[x], po;
	L(i, 0, 2)
		L(j, 0, 2)
		{
			if(i + j <= cn)
			{
				po = cn - i - j;
				z.A[d(i, j)][0] |= (1 << d(j, po % 3));
			}
			if(i + j + 2 <= cn)
			{
				po = cn - i - j - 2;
				z.A[d(i, j)][1] |= (1 << d(j, po % 3));
			}
		}
	tr[p] = z; return ;
}
inline int lc(int p) {return p << 1;}
inline int rc(int p) {return p << 1 | 1;}
inline void push_up(int p) {tr[p] = Merge(tr[lc(p)], tr[rc(p)]); return ;}
inline void build(int l, int r, int p)
{
	Clear(tr[p]); tr[p].A[0][0] = 1;
	if(l == r)
		return ;
	int mid = (l + r) >> 1;
	build(l, mid, lc(p)); build(mid + 1, r, rc(p));
	return ;
}
inline void update(int l, int r, int p, int pos)
{
	if(l == r) {Set(p, l); return ;}
	int mid = (l + r) >> 1;
	if(mid >= pos) update(l, mid, lc(p), pos);
	else update(mid + 1, r, rc(p), pos);
	push_up(p);
//	cout << l << " " << r << "awa" << endl;
//	L(i, 0, 8)
//		L(j, 0, 1)
//		{
//			int v = tr[p].A[i][j];
//			while(v)
//			{
//				cout << i << " " << j << " " << id[lowbit(v)] << endl;
//				v -= lowbit(v);
//			}
//		}
	return ;
}
inline void solve()
{
	n = read(); tot = 0;
	L(i, 1, n) a[i] = read(), b[++tot] = a[i];
	sort(b + 1, b + tot + 1);
	int mer = unique(b + 1, b + tot + 1) - b - 1; tot = mer;
	t[1] = 1;
	L(i, 2, tot)
	{
		if(b[i] - b[i - 1] > 1) t[i] = t[i - 1] + 2;
		else t[i] = t[i - 1] + 1;
	}
	m = t[tot];
	L(i, 1, m) cnt[i] = 0;
	build(1, m, 1);
	L(i, 1, n) a[i] = lower_bound(b + 1, b + tot + 1, a[i]) - b, a[i] = t[a[i]];
	L(i, 1, n)
	{
	//	cout << a[i] << " " << m << endl;
		cnt[a[i]]++; update(1, m, 1, a[i]);
		if(tr[1].A[0][1] & 1) putchar('1');
		else putchar('0');
	}
	puts(""); return ;
}
signed main()
{
	int T = read(); init();
	L(i, 1, T) solve();
	return 0;
}


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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 9720kb

input:

4
8 1 1 4 5 1 4 4 3
14 1 1 3 5 4 2 5 5 4 6 6 2 2 4
17 3 5 3 2 2 3 3 1 4 3 1 3 3 5 2 4 4
8 2 4 11 11 14 8 6 3

output:

01000001
01001001000001
00000000001000001
00000000

result:

ok 4 lines

Test #2:

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

input:

10
2 1 1
3 1 1 1
3 1 2 3
5 1 1 1 1 1
5 1 1 1 2 2
5 1 1 1 2 3
8 1 1 1 1 1 1 2 3
5 2 2 1 1 1
5 3 2 1 1 1
8 3 2 1 1 1 1 1 1

output:

01
010
000
01001
01001
01001
01001001
01001
00001
00001001

result:

ok 10 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 9796kb

input:

10000
20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
13 1 1 1 1 1 1 1 1 1 1 1 1 1
4 1 1 1 1
5 1 1 1 1 1
15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
6 1 1 1 1 1 1
3 1 1 1
4 1 1 1 1
6 1 1 1 1 1 1
1 1
7 1 1 1 1 1 1 1
2 1 1
2 1 1
20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
12 1 1 1 1 1 1 1 1 1 1 1 1
1 1
8 1 1 1 1 1 1 1...

output:

01001001001001001001
0100100100100
0100
01001
010010010010010
010010
010
0100
010010
0
0100100
01
01
01001001001001001001
010010010010
0
01001001
010010010
01001001
01001001001001001001001001001001
010
0100100100
0100100100
01
010010
0100100100100100
010010
0100100
01001001001001001001
01001
0
010
0...

result:

ok 10000 lines

Test #4:

score: 0
Accepted
time: 9ms
memory: 9724kb

input:

10000
6 2 2 1 1 1 2
10 2 1 2 2 2 2 1 2 1 1
3 2 1 1
4 2 1 1 1
35 1 1 2 1 1 2 2 2 2 2 2 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1
2 1 1
6 2 1 2 2 2 2
35 1 2 2 1 2 1 1 1 2 1 1 1 1 2 1 2 1 2 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 2 2
7 2 1 2 2 1 2 2
4 1 2 2 1
2 1 2
8 1 1 2 2 2 1 1 2
7 1 2 2 2 2 1 1
13 2 1 ...

output:

010010
0000000100
000
0000
01000000000001001001000000001001001
01
000000
00001001000001001001001001000001000
0000100
0000
00
01001000
0000000
0000100000000
0100100000
0100
01
0
0000
0
0100000100000000100
00001000
010
000
000
0000100100100000
010
00000001001001
0000100
01001001
00
0100
0100100
010010...

result:

ok 10000 lines

Test #5:

score: 0
Accepted
time: 11ms
memory: 9792kb

input:

10000
18 2 2 3 1 2 3 3 2 1 3 2 1 3 3 2 1 1 2
2 1 3
25 1 3 2 2 2 1 1 1 1 2 1 2 2 1 3 3 3 2 1 2 1 3 1 2 2
10 1 1 2 3 1 3 2 2 3 1
13 1 1 1 1 3 2 2 3 1 1 3 3 1
2 1 2
5 1 2 1 2 1
2 2 3
14 1 3 1 2 3 2 1 3 1 2 2 3 3 1
23 1 3 2 1 2 3 2 1 2 3 2 3 2 3 2 2 3 3 1 1 3 1 3
14 2 3 1 2 1 2 1 2 1 1 1 2 2 1
4 2 2 1 2...

output:

010010010010010010
00
0000100100100100100100100
0100100100
0100000100100
00
00001
00
00000001001001
00000001001001001001001
00000001001001
0100
0
0000000100
0
0000
00001000001001001001
0000100100
000010010
0
00001001001001001
01000000000001001001001001001001
0000100
00000001001001001001001
0000
0100...

result:

ok 10000 lines

Test #6:

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

input:

10000
4 1 4 4 1
4 1 2 2 1
8 1 4 1 2 4 1 3 3
2 1 2
1 2
12 4 1 2 1 4 1 1 4 4 3 2 3
3 1 4 1
7 2 1 4 1 3 2 2
34 3 3 2 3 1 1 2 3 4 3 3 1 3 4 4 2 1 3 2 1 3 3 2 2 3 4 3 3 2 4 1 2 3 4
8 3 2 2 3 2 1 3 2
11 4 3 4 3 2 1 2 1 2 4 4
15 2 1 4 3 1 2 1 4 4 2 1 1 4 2 3
3 1 4 4
5 2 3 1 2 4
24 3 1 1 4 4 3 3 1 3 4 2 1 3...

output:

0000
0000
00000000
00
0
000000000000
000
0000100
0100100100000100100100100100100100
00001001
00000001000
000010000010010
000
00000
000000010010010010010010
01001001000000
00
00
000000000010000
010010000010
0000
0000100100100100100
00000000001001001
000010010010010000010010010010010010010010010010010...

result:

ok 10000 lines

Test #7:

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

input:

10000
6 2 4 5 5 5 1
1 5
13 1 2 3 4 3 4 4 2 5 1 5 4 1
6 4 3 3 5 3 5
2 4 1
7 1 1 5 3 1 2 1
10 5 1 2 1 1 5 2 4 1 5
7 3 4 3 1 5 3 3
9 5 5 4 1 3 2 2 5 3
23 3 5 5 4 4 3 4 1 1 2 2 2 1 2 4 2 4 2 2 1 1 5 4
7 2 4 5 1 5 2 3
9 1 2 5 5 2 2 4 1 4
10 4 1 3 3 3 3 5 4 4 3
3 1 3 3
7 3 2 3 1 3 4 3
10 5 4 1 1 1 4 5 5 4...

output:

000000
0
0000000100100
000010
00
0100000
0000000000
0000000
010000000
00000000001000001000001
0000000
000000000
0000000000
000
0000100
0000000100
000000000010
000010000
00000
0000
000000000
0100100000
000000
0
0000000100
000000000000
01
00000000
00000000
0
000
0000000100
00000001
0000000000
0
0
0000...

result:

ok 10000 lines

Test #8:

score: 0
Accepted
time: 16ms
memory: 9872kb

input:

10000
10 5 6 5 4 6 6 1 3 6 5
4 2 2 1 1
1 1
20 5 1 2 2 4 4 4 6 4 1 1 3 3 4 5 5 5 2 4 3
13 1 2 1 1 5 6 4 5 4 6 1 4 4
3 5 3 2
14 4 6 4 3 5 3 3 6 3 1 2 3 3 4
19 1 4 3 1 2 5 5 3 5 2 4 6 5 1 4 5 3 1 5
7 5 5 1 6 6 4 2
4 6 6 1 3
5 2 1 4 1 1
1 3
4 3 5 4 3
5 5 6 6 3 4
3 6 6 4
1 6
21 5 3 1 5 6 5 6 5 6 4 3 2 3 ...

output:

0000000000
0100
0
00000000001001001001
0000000000000
000
00000000000000
0000100000100100100
0100000
0100
00000
0
0000
00001
010
0
000000000000000010010
0000000100100000000100100100100100100100100100100100
0100100000000000
00000000
00000000000001001
0000000
000000000010
0
00000000000000001001001
0000...

result:

ok 10000 lines

Test #9:

score: 0
Accepted
time: 17ms
memory: 7672kb

input:

10000
8 4 4 1 3 1 7 3 3
6 2 7 6 3 2 5
8 4 7 2 6 4 2 1 7
28 2 6 1 7 2 2 7 4 6 6 6 1 3 1 4 5 1 1 4 2 5 5 6 7 6 5 4 7
2 7 6
9 5 5 4 6 5 6 4 2 5
28 5 7 6 6 3 6 4 4 6 7 4 3 3 4 6 6 6 6 1 2 6 7 6 2 6 6 3 2
2 2 3
2 3 2
17 4 2 6 6 1 6 5 4 2 1 7 3 3 7 1 4 6
16 2 1 4 5 7 2 2 6 3 2 6 4 5 1 4 6
16 6 1 6 4 3 1 5...

output:

01000000
000000
00000000
0000000000000000000000000000
00
010010000
0000000000000100100000100100
00
00
00000000000000001
0000000000000100
0000000000000000
01
0
000
000000000000000000000000010010010
00
01001001000000
000
000
0
0
000000
0000000
0000
000000000000000000000010010010
00
0000000
0000000
000...

result:

ok 10000 lines

Test #10:

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

input:

10000
3 3 4 7
10 8 3 4 3 7 6 7 4 4 5
1 7
8 8 4 1 6 7 3 6 1
16 1 7 2 7 6 3 3 6 3 6 6 7 3 2 1 5
8 4 5 1 2 6 3 5 3
33 8 2 1 7 3 4 4 3 4 1 3 8 6 2 3 4 6 7 3 5 5 2 7 1 2 2 7 1 5 1 5 2 5
3 6 3 2
3 3 4 3
46 1 5 1 5 5 4 8 4 4 6 7 1 7 5 2 7 1 5 6 5 4 2 7 7 4 8 2 5 2 1 4 3 2 3 1 8 5 7 5 7 8 3 7 8 3 1
3 1 8 3
...

output:

000
0000000000
0
00000000
0000000000000000
00000000
000000000000000000010000010010010
000
000
0000100000100000000000000000000000000100100100
000
00000
0
0
0
0000000000
00001000
0
0100000000000
000
0000000100000100000100100
00000000001000000000000000000000
0000000000
00000000000000000000
000000000010...

result:

ok 10000 lines

Test #11:

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

input:

10000
10 6 3 7 4 1 6 7 7 2 4
1 8
17 5 8 5 7 8 6 8 9 3 1 2 2 4 3 6 9 1
14 2 4 3 5 8 2 5 1 7 1 8 6 3 6
14 2 3 7 9 2 6 1 9 3 3 2 1 5 7
10 8 9 1 6 8 9 3 8 9 6
7 9 8 2 3 9 7 6
13 3 7 2 3 7 2 6 8 6 5 8 3 2
7 1 7 3 5 2 7 1
16 7 9 6 9 3 7 9 6 3 7 9 1 3 4 2 9
24 6 5 2 3 7 5 1 6 7 9 6 1 8 6 4 2 4 2 5 5 9 6 6 ...

output:

0000000000
0
00000000000000001
00000000000001
00000000000000
0000000000
0000000
0000000000000
0000000
0000000000000000
000000000000000000000000
000000
00000000000001
000000000000000
00000
00000
00
00000000000000
0
000
000000000000000000010000010
0000
0000100000
0000000
00000
0
0000000
00
00000000000...

result:

ok 10000 lines

Test #12:

score: 0
Accepted
time: 20ms
memory: 9872kb

input:

10000
12 10 9 8 4 4 8 9 6 1 3 10 4
5 3 3 1 2 3
3 1 4 8
6 2 6 5 8 9 3
4 4 9 5 9
11 1 2 5 3 7 2 1 8 2 10 6
3 4 2 1
6 2 2 6 4 8 6
8 10 9 1 8 1 8 7 3
2 2 6
5 1 5 9 2 2
12 6 8 1 7 9 7 1 3 2 2 2 6
1 4
9 6 9 10 3 7 4 2 7 3
7 8 3 1 6 10 8 5
2 7 8
9 4 3 6 3 3 10 5 4 7
7 9 7 10 4 9 8 9
9 4 4 10 9 8 3 7 8 9
4 ...

output:

000010000000
01001
000
000000
0000
00000000000
000
010000
00001000
00
00000
000000000000
0
000000000
0000000
00
000000000
0000000
010010000
0000
000000000000
000
0000000000000
0
000000
000010000000000000000000000010000
0000000000000
00
000000000
000000000000
00000000
000000000000
000000000000000000
...

result:

ok 10000 lines

Test #13:

score: 0
Accepted
time: 5ms
memory: 9720kb

input:

1000
78 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
201 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

010010010010010010010010010010010010010010010010010010010010010010010010010010
010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010
0100100100100100100...

result:

ok 1000 lines

Test #14:

score: 0
Accepted
time: 9ms
memory: 9720kb

input:

1000
52 1 1 2 2 1 2 1 1 1 2 1 1 1 1 1 2 1 1 2 1 1 2 2 2 1 2 1 1 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 2 2 2 1 1 1
103 1 1 2 2 1 1 2 1 2 1 1 1 2 2 1 1 1 1 1 2 1 2 2 1 1 1 1 2 2 2 1 1 1 2 1 1 2 1 2 1 1 2 2 2 2 2 1 2 1 2 2 1 1 1 1 1 2 1 2 2 1 1 1 1 1 1 1 2 2 2 1 2 2 2 2 1 1 2 1 2 2 2 2 1 2 1 1 2 2 1 2 1 ...

output:

0100100100000000100100100000000000100100100000100100
0100100100000100100000100100100100000100100100100000100100000100100100100100100100100100100100000100100
00001001001000001001000001001001001001001000001001001001001001001000001001001000001000000001000000001000000001001000000000001000001000001000001...

result:

ok 1000 lines

Test #15:

score: 0
Accepted
time: 11ms
memory: 9788kb

input:

1000
16 2 3 3 2 2 2 3 1 1 1 1 1 2 1 2 1
157 1 2 1 3 1 2 1 2 3 2 2 3 3 1 2 1 2 1 3 2 1 1 1 3 3 2 3 1 1 1 2 1 1 2 1 1 2 2 2 3 1 2 2 2 3 1 3 3 1 1 2 1 2 1 2 1 1 3 3 3 2 3 2 3 3 1 3 3 2 3 3 2 2 3 2 3 3 1 2 2 3 3 1 1 2 1 3 2 2 2 1 3 3 1 1 3 1 1 1 3 3 2 2 2 2 2 3 1 1 3 3 1 1 3 2 1 2 1 3 1 2 2 1 1 2 2 1 1 ...

output:

0000100100100100
0000100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100
00000001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001...

result:

ok 1000 lines

Test #16:

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

input:

1000
113 3 3 4 3 2 1 1 3 3 1 3 3 1 2 1 4 3 1 3 2 2 4 3 1 1 1 1 1 4 3 4 2 3 4 2 4 2 2 4 4 3 2 4 1 4 4 4 4 1 1 2 4 3 4 2 3 4 1 2 4 1 1 3 2 2 4 1 3 2 1 3 3 4 2 4 1 3 1 4 1 3 4 1 1 1 2 2 3 3 4 3 4 2 4 2 1 2 2 4 1 2 2 3 4 1 3 1 3 2 4 3 1 1
163 1 4 3 3 2 1 2 3 4 4 4 3 2 2 2 3 2 3 1 2 2 2 4 3 3 3 3 1 1 3 3...

output:

01001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001
0000000000000100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100
0100100100100000100100...

result:

ok 1000 lines

Test #17:

score: 0
Accepted
time: 11ms
memory: 9848kb

input:

1000
58 5 3 4 5 4 4 2 2 3 1 2 2 3 4 2 2 4 1 2 2 2 4 5 3 3 3 3 1 4 1 4 1 4 4 5 5 2 2 2 2 3 5 3 1 3 4 1 5 5 1 1 1 4 2 3 2 1 4
113 2 3 1 3 3 5 1 4 4 2 4 2 3 1 3 1 3 3 5 2 2 1 3 4 1 3 2 4 4 3 5 5 5 2 4 1 3 4 2 3 3 5 3 5 5 4 3 5 2 4 5 5 4 2 3 4 1 4 2 3 1 1 3 1 1 1 4 3 4 5 4 5 5 3 2 2 1 3 1 3 1 1 5 3 5 3 ...

output:

0000000000000100100000100100100100100100100100100100100100
00001000001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001
0000000000100100100000100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100...

result:

ok 1000 lines

Test #18:

score: 0
Accepted
time: 16ms
memory: 9788kb

input:

1000
98 3 5 4 6 1 2 5 5 2 6 4 6 5 4 6 2 4 6 3 2 5 5 3 1 3 2 1 1 6 3 3 1 3 3 6 1 3 6 2 1 2 4 6 6 3 5 4 2 2 2 1 6 2 2 4 6 5 3 1 5 6 3 5 2 1 6 2 2 4 5 3 1 5 3 2 3 3 2 4 6 3 1 3 2 1 2 1 5 2 1 3 6 2 5 2 3 4 4
197 5 1 5 4 6 3 3 3 6 4 1 3 2 2 5 6 6 2 3 2 4 5 3 2 2 2 5 2 6 6 1 3 2 5 1 1 4 4 2 2 3 5 4 1 5 4 ...

output:

00000001000000001001001001001001001001001001001001001001001001001001001001001001001001001001001001
00000000001001000000001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001
000...

result:

ok 1000 lines

Test #19:

score: 0
Accepted
time: 18ms
memory: 9748kb

input:

1000
34 2 4 7 6 1 6 7 5 3 3 6 4 1 1 1 2 3 2 5 2 1 3 3 2 1 2 1 7 1 3 1 4 7 1
45 3 7 5 1 5 7 6 7 6 4 6 6 5 3 5 4 5 6 7 4 1 5 3 5 7 2 2 5 3 6 3 2 6 7 2 1 7 5 5 4 6 5 1 1 4
286 5 6 5 7 6 5 6 3 3 2 7 1 3 4 6 3 4 2 2 2 7 6 6 7 5 4 4 7 5 1 4 6 5 6 6 7 6 2 1 1 3 7 2 2 3 7 2 5 2 5 6 2 3 4 3 4 1 3 6 4 7 1 5 1...

output:

0000000000100100100100000100100100
000000000000000000000000010010010010010010010
000000000000010000000010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...

result:

ok 1000 lines

Test #20:

score: 0
Accepted
time: 18ms
memory: 9788kb

input:

1000
116 3 6 8 2 5 7 6 7 2 2 8 7 5 3 8 1 7 4 3 2 2 2 4 8 1 7 1 6 5 7 5 4 2 3 5 4 7 1 3 6 2 1 6 4 2 2 8 7 3 3 7 8 5 2 4 8 5 1 7 1 3 3 1 2 3 4 8 6 4 7 6 6 4 5 3 3 1 4 7 5 1 6 1 6 3 6 2 8 4 7 2 3 4 4 2 7 6 1 1 1 3 1 8 5 8 5 5 1 3 3 4 3 2 5 1 5
41 4 6 7 8 5 1 4 5 7 2 3 6 4 2 8 3 5 7 8 6 6 1 6 8 7 7 7 1 ...

output:

00000000000000000001001000001001001001001001000001001001001001001001001001001001001001001001001001001001001001001001
00000000000000001001001001001001001001001
0000000000000100100100100100100100100100100100100100000100100100100100100100100100100
0000000100100000000000000000000100000000100100100100100...

result:

ok 1000 lines

Test #21:

score: 0
Accepted
time: 20ms
memory: 9788kb

input:

1000
398 9 6 8 3 8 3 7 4 9 6 4 1 9 2 3 3 1 5 9 7 9 8 8 4 8 5 4 2 8 1 8 1 7 2 1 5 6 3 8 5 1 4 6 6 2 8 4 6 9 7 9 6 3 6 7 1 9 1 2 1 2 3 4 9 1 6 1 6 5 8 8 9 5 7 3 2 1 8 3 9 6 9 7 4 1 2 6 9 3 4 2 1 6 2 1 7 5 5 7 4 8 5 2 2 5 9 7 7 7 1 6 7 9 7 5 9 5 2 9 5 4 4 8 3 5 7 7 4 2 7 1 5 8 8 1 1 2 7 3 1 2 9 3 3 4 7...

output:

000000000000000000010000010000000000000010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...

result:

ok 1000 lines

Test #22:

score: 0
Accepted
time: 23ms
memory: 9872kb

input:

1000
276 4 6 6 5 10 2 8 1 3 6 5 7 7 6 1 9 6 6 7 1 5 1 9 1 1 6 3 3 4 6 7 4 1 3 3 2 3 7 4 6 3 9 8 1 2 10 1 5 6 1 5 9 1 2 1 10 10 1 6 7 1 3 3 6 8 4 8 2 5 1 7 3 3 1 2 3 10 7 5 1 4 6 3 4 6 7 10 5 2 10 7 9 7 6 8 4 5 8 3 4 2 10 8 4 6 4 10 7 10 4 6 1 6 4 4 10 8 8 9 6 6 8 7 1 9 1 10 5 3 2 3 5 6 2 4 9 7 2 8 3...

output:

000000000000000010010000000000000000000000000000000010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010
01000000000000000000000...

result:

ok 1000 lines

Test #23:

score: 0
Accepted
time: 81ms
memory: 47516kb

input:

1
100000 319019695 684796567 776501655 485890027 378876814 910406843 290691618 73749084 917033829 823428124 952710948 303636374 546221407 841644103 266683892 144186464 744158620 37509341 694211099 487878358 680364467 742343188 226632153 925820646 764244779 25212213 829800608 612719830 550298624 3538...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #24:

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

input:

100000
1 326940215
1 267075745
1 211385885
1 613673458
1 461592821
1 717955725
1 712537581
1 492381200
1 469992317
1 694263008
1 771207665
1 321283148
1 812988452
1 618773233
1 859023501
1 331701599
1 560669823
1 447309052
1 51836844
1 832103208
1 607495658
1 340951202
1 526714681
1 660379433
1 6455...

output:

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
0
0
0
...

result:

ok 100000 lines

Test #25:

score: 0
Accepted
time: 69ms
memory: 28688kb

input:

1
100000 548240686 548240686 548240686 143941014 143941014 143941014 546526717 546526717 546526717 167752949 167752948 167752947 165068374 165068375 165068376 124065130 124065132 124065131 615222254 615222254 615222254 229103672 229103670 229103671 656376308 656376309 656376310 758066816 758066816 7...

output:

010010010000000000010000000010000000000000010010010010000000010000010000000000010000000000000000010010010000000000010000010000010000000010010000000010000010000010000000010000000000000010010010010000000000000010010010000000000000010010010000010000010010000000000000000000000000010000010000000010000010...

result:

ok single line: '010010010000000000010000000010...0000000000000100000000100100000'

Test #26:

score: 0
Accepted
time: 71ms
memory: 28896kb

input:

1
100000 486883011 486883011 486883011 31774166 31774166 31774166 23991247 23991248 23991249 233745051 233745052 233745050 477238041 477238041 477238041 160920877 160920876 160920878 726858495 726858495 726858495 447729292 447729291 447729290 93551965 93551965 93551965 861085675 861085673 861085674 ...

output:

010010000000010000010000010000010000010000010010010010000000010000000010010000010000000000000000010000000010010000000000010000000000000010010010010000000000000000000010010000000010000010010000010010010010000000010000000000000000010000000010010000010000010010010000000000010010000010010010010010000000...

result:

ok single line: '010010000000010000010000010000...0000100000100000100000000100000'

Test #27:

score: 0
Accepted
time: 66ms
memory: 26456kb

input:

1
100000 902133518 902133518 902133518 107746989 107746988 107746987 410010571 410010571 410010571 662225663 662225665 662225664 68958605 68958605 68958605 987854865 987854867 987854866 918623157 918623159 918623158 250152859 250152859 250152859 185977266 185977266 185977266 312223777 312223778 3122...

output:

010000010000010000000010010000010000010010000010010000000000000000000000000000010000000010010010000010010010000010010010010000000010010000000010010010000000000000010000000010010000010000000000000000010010000000000010000010010000010000000010010010010000010010010000010000000000000000000010000000010000...

result:

ok single line: '010000010000010000000010010000...0000000100100000000100100100100'

Test #28:

score: 0
Accepted
time: 63ms
memory: 26524kb

input:

1
100000 890693879 344991401 890693878 646867680 646867681 646867679 158284822 158284821 158284823 234979554 234979556 234979555 13592522 13592523 13592524 708289884 708289885 708289883 938295938 938295938 938295938 183729427 183729425 183729426 143900413 143900413 143900413 937110641 937110640 9371...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #29:

score: 0
Accepted
time: 63ms
memory: 28872kb

input:

1
100000 313782047 394468603 313782046 845822062 793211454 778956878 249715455 249715455 249715455 310015968 310015969 310015970 864969878 864969880 864969879 334448044 334448044 334448044 570746533 570746532 570746534 833239884 833239884 833239884 295761991 598317851 598317851 739436582 944550615 7...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #30:

score: 0
Accepted
time: 78ms
memory: 26428kb

input:

1
100000 613355068 521027377 946476023 152750182 460480501 164664024 325755163 326607001 838874558 852293199 663275108 171989009 845409129 636711154 75637524 4593678 368246662 658057507 938913610 963169845 323488934 724657216 473517745 655112861 844689604 874494151 555332035 526973242 840830957 5409...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #31:

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

input:

1
100000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000...

output:

010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010...

result:

ok single line: '010010010010010010010010010010...0100100100100100100100100100100'

Test #32:

score: 0
Accepted
time: 66ms
memory: 11956kb

input:

1
100000 5647 5648 5646 8810 8810 8810 1483 1483 1483 9775 9775 9775 9885 9885 9885 2717 2717 2717 5688 5688 5688 6974 6976 6975 6989 6987 6988 5137 5137 5137 876 876 876 385 387 386 7439 7438 7440 5984 5984 5984 8162 8164 8163 7682 7682 7682 1125 1123 1124 6356 6356 6356 3216 3215 3217 5695 5695 56...

output:

000010010010010010010000000010010000000010000010000010000010000000010010000010000000000000000010000010010010010010000010010000010000010000010000010000000010000000000000000000000000000000000000000000000000000000000000010000000000010000010000000010000000010010000000000010000000010000010000010010010000...

result:

ok single line: '000010010010010010010000000010...0100100100100100100100100100100'

Test #33:

score: 0
Accepted
time: 59ms
memory: 18192kb

input:

1
100000 33574 33574 33574 85530 85530 85530 12892 12892 12892 62725 62725 62725 80744 80744 80744 5307 5306 5308 94833 94831 94832 51664 51664 51664 20445 20446 20447 87691 87693 87692 76200 76200 76200 83804 83805 83803 66280 66281 66282 60119 60119 60119 80685 80685 80685 83440 83440 83440 50268 ...

output:

010010010010010000000010000000010000000010010010000000010010000000010010010010000000010010010010000000000000010010010000010010010010010010010000010000010000010000010010000010010000010010000010000010010010010000010010000010000010000010000000010000000010000010000000000000010000010000010000000010010000...

result:

ok single line: '010010010010010000000010000000...0100000000100100100100100100000'

Test #34:

score: 0
Accepted
time: 63ms
memory: 28408kb

input:

1
100000 767950 767951 767949 989767 989769 989768 886551 886551 886551 278408 278408 278408 370353 370352 370351 314098 314098 314098 188227 188227 188227 321896 321896 321896 883710 883708 883709 586169 586167 586168 382223 382223 382223 503816 503817 503818 879705 879703 879704 630501 630502 6305...

output:

000000010010000010010010000000010000000000000010000010000000010000010010000010010000010000010000010010010010000000010010010010010010010000010010000010010010010000010010010010000000000000000010010010000010000010010010010010000010010010000000010000000000000010000010010010000000010010010010010000000000...

result:

ok single line: '000000010010000010010010000000...0100000100100000000000000000100'

Test #35:

score: 0
Accepted
time: 72ms
memory: 11884kb

input:

1
100000 120983 120984 120985 122271 122271 122271 120784 120784 120784 115536 115534 115535 120408 120408 120408 117478 117478 117478 122007 122008 122006 121208 121208 121208 115276 115276 115276 121387 121386 121385 124351 124352 124353 117601 117600 117602 123587 123588 123589 116397 116397 1163...

output:

000010010000010010000010010000000000000010000000010000000000000010010010000000000000010010010010010010010000000010000000010010010010010000010000000010010000000010010010010010010000010000010000010010000010000010010000010000010010000010010000000010000000000000000010010000010000000000010000010010000010...

result:

ok single line: '000010010000010010000010010000...0100100100100100100100100100100'

Test #36:

score: 0
Accepted
time: 69ms
memory: 20300kb

input:

1
100000 999985315 999985317 999985316 999928552 999928551 999928550 999941812 999941814 999941813 999918410 999918408 999918409 999940144 999940146 999940145 999980236 999980236 999980236 999948336 999948337 999948335 999987144 999987144 999987144 999939157 999939156 999939155 999992003 999992001 9...

output:

000000000000000010000010000000000000000000000010010000000010000000000010000000000000010000010000000010010010000010010010010010010010010000000010000010000000000000010000010000000000000000000010010010000010010010010010000000000010000010010010000000000000000010010000010000000000000010010010010010010000...

result:

ok single line: '000000000000000010000010000000...0000000100000100000000000100000'

Test #37:

score: 0
Accepted
time: 60ms
memory: 26488kb

input:

1
100000 500301592 500301592 500301592 500763460 500763460 500763460 500017201 500017202 500017200 500465269 500465267 500465268 500483247 500483247 500483247 500672273 500672274 500672275 500177201 500177201 500177201 500020281 500020279 500020280 500872375 500872376 500872377 500271895 500271894 5...

output:

010010000000010000010000000000010000010000010000010000000000000010000010010000010010010010000010010010000010000000000010010000000010010000010000000010010010010000000000010000000010010000000000000000000000010010010010000010000010000010000000000010010000010000000010010010010010010010010010000000010010...

result:

ok single line: '010010000000010000010000000000...0100100100000000000100100000000'

Test #38:

score: 0
Accepted
time: 66ms
memory: 12340kb

input:

1
100000 123691 123690 123692 116508 116509 116507 122802 122802 122802 124217 124217 124217 120175 120176 120174 115215 115217 115216 116365 116365 116365 119862 119862 119862 114796 114796 114796 121578 121579 121577 116161 116161 116161 117744 117745 117743 121353 121353 121353 121347 121346 1213...

output:

000000010010000000010010010000010000010000000010010010000010010010010000010000000000000000010010010000010010010000010010010010000000010010000000000000000010000000000000010000000000000000010010010000010010010010000000000010000000010010000000010010000000000000000000010000010010000000010010000000010000...

result:

ok single line: '000000010010000000010010010000...0100100100100100100100100100100'

Test #39:

score: 0
Accepted
time: 48ms
memory: 11912kb

input:

1
100000 999999670 999999670 999999670 1000000000 1000000000 1000000000 999999532 999999532 999999532 999999043 999999043 999999043 999999296 999999296 999999296 999999596 999999595 999999594 999999581 999999580 999999579 999999888 999999886 999999887 999999920 999999921 999999919 999999230 99999922...

output:

010010010010010000000000000000010000000010010010000000000010000000010010000010010010010010010000010000010000000000010010010010010000000010000000010010000010010010000000000000010010000000010010010000010000000010000000010000000000000000010000010000000000000000010000000000010010000010010000010010010010...

result:

ok single line: '010010010010010000000000000000...0100100100100100100100100100100'

Test #40:

score: 0
Accepted
time: 63ms
memory: 16116kb

input:

1
100000 500023931 500023931 500023931 500013215 500013214 500013216 500000897 500000897 500000897 500006241 500006241 500006241 500016640 500016641 500016642 500014218 500014218 500014218 500021767 500021766 500021768 500028583 500028583 500028583 500025459 500025459 500025459 500008283 500008283 5...

output:

010000010010000010000010010010000010010000000010010010000010000000000010000010000000010010010000010000010000010000000000010010000000000000000010010010000010010000000000000000010000000000000010000010010000010010000010010010000000010000010000010000010000010000010010010010000000010000000010010000010000...

result:

ok single line: '010000010010000010000010010010...0100100100100100100100100100100'

Extra Test:

score: 0
Extra Test Passed