QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#72352#5166. 回文匹配zhoukangyang40 738ms539792kbC++174.3kb2023-01-15 14:58:202023-01-15 14:59:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 14:59:02]
  • 评测
  • 测评结果:40
  • 用时:738ms
  • 内存:539792kb
  • [2023-01-15 14:58:20]
  • 提交

answer

#include<bits/stdc++.h>
#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 ll long long 
#define vi vector < int > 
#define sz(a) ((int) (a).size()) 
#define me(a, x) memset(a, x, sizeof(a)) 
#define ull unsigned long long 
#define u128 __uint128_t 
using namespace std;
const int N = 1 << 20, T = 1 << 19, M = N * 20;
const int mod = 1019260817, G = 19491001;

int frt;
struct V {
	int val, sum;
	inline V (int VAL = 0, int SUM = 0) {
		val = VAL, sum = SUM;
	}
} seg[M];
inline V operator + (V a, V b) {
	return V((ll) a.val * b.val % mod, (a.sum + (ll) a.val * b.sum % mod) % mod);
}

int ch[M][2], tot;
void upd(int x) {
	seg[x] = seg[ch[x][0]] + seg[ch[x][1]];
}

void build(int &x, int L, int R) {
	x = ++tot;
	if(L == R) return seg[x] = V(G, 0), void(); 
	int mid = (L + R) >> 1;
	build(ch[x][0], L, mid), build(ch[x][1], mid + 1, R); upd(x);
}

void add(int &x, int L, int R, int p, int w) {
	int u = ++tot;
	ch[u][0] = ch[x][0], ch[u][1] = ch[x][1], seg[u] = seg[x], x = u;
	if(L == R) return seg[x] = V(G, w), void();
	int mid = (L + R) >> 1; 
	p <= mid ? add(ch[x][0], L, mid, p, w) : add(ch[x][1], mid + 1, R, p, w); upd(x);
}
V query(int x, int L, int R, int l, int r) {
	if(l <= L && R <= r) return seg[x];
	int mid = (L + R) >> 1;
	if(l <= mid && mid < r) 
		return query(ch[x][0], L, mid, l, r) + query(ch[x][1], mid + 1, R, l, r);
	return l <= mid ? query(ch[x][0], L, mid, l, r) : query(ch[x][1], mid + 1, R, l, r);
}

struct node {
	int pc, len;
	node (int PC = 0, int LEN = 0) {
		pc = PC;
		len = LEN;
	}
} ;

bool operator < (node a, node b) {
	int lcp = 0, len = min(a.len, b.len);
	R(j, 18, 0) { 
		int xl = lcp + (1 << j);
		if(xl <= len && 
			query(a.pc, 0, T - 1, a.len - xl, a.len - 1).sum == 
			query(b.pc, 0, T - 1, b.len - xl, b.len - 1).sum) lcp = xl;
	}
	if(lcp == len) {
		if(b.len == lcp) return false;
		else return true;
	} else {
		return query(a.pc, 0, T - 1, a.len - lcp - 1, a.len - lcp - 1).sum < 
			   query(b.pc, 0, T - 1, b.len - lcp - 1, b.len - lcp - 1).sum;
	}
}

int TP, n, q;
string s[N];
string S[N]; 

int ff[N];
int find(int x) {
	return ff[x] == x ? x : ff[x] = find(ff[x]);
}

int col[N], mp[N];

int qx[N], qy[N];
vi qry[N];
vi nxt[N], lst[N]; 
vector < node > rt[N];
int f[N];

map < int, int > mmp[N];

namespace hw {
	int n, p, ch[N][26], f[N], len[N];
	int ns[N];
	char s[N]; 
	int getfa(int x) {
		for(; p < len[x] + 1 || s[p - len[x] - 1] != s[p]; x = f[x]) ;
		return x;
	}
	int lst, tot = 1; 
	void ins() {
		lst = getfa(lst);
		if(!ch[lst][s[p] - 'a']) 
			++tot, f[tot] = ch[getfa(f[lst])][s[p] - 'a'], ch[lst][s[p] - 'a'] = tot, 
			len[tot] = len[lst] + 2;
		lst = ch[lst][s[p] - 'a'];
	}
	int main() {
		L(i, 0, tot) 
			me(ch[i], 0), f[i] = len[i] = 0;
		tot = 1, lst = 0;
		f[0] = 1, len[1] = -1;
		L(i, 1, n) p = i, ins(), ns[i] = len[lst];
		return 0;
	}
}

int hsh[N];

void solve1() {
	L(t, 1, q) {
		int x = qx[t], y = qy[t];
		if(mmp[x].count(y)) {
			cout << mmp[x][y] << '\n';
			continue;
		}
		int ns = 0;
		L(i, sz(s[x]) - 1, sz(s[y]) - 1) {
			int hsw = query(rt[y][i].pc, 0, T - 1, i - sz(s[x]) + 1, i).sum;
			if(hsw == hsh[x]) {
				ns += 1;
			}
		}
		cout << (mmp[x][y] = ns) << '\n';
	}
}

void solve2() {
	
}

int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> TP >> n >> q;
	assert(TP == 0);
	build(frt, 0, T - 1);
	L(i, 1, n) 
		cin >> s[i], lst[i].resize(sz(s[i])), nxt[i].resize(sz(s[i])), rt[i].resize(sz(s[i]));
	L(i, 1, q) {
		cin >> qx[i] >> qy[i];
		qry[qy[i]].emplace_back(qx[i]);
	}
	L(i, 1, n) { 
		hw :: n = sz(s[i]);
		L(j, 0, sz(s[i]) - 1) hw :: s[j + 1] = s[i][j];
		hw :: main();
		L(j, 0, sz(s[i]) - 1) ff[j] = j;
		L(j, 0, sz(s[i]) - 1) ff[j] = ff[j - hw :: ns[j + 1] + 1];
		L(j, 0, sz(s[i]) - 1) mp[ff[j]] = -1;
		int cur = frt;
		L(j, 0, sz(lst[i]) - 1) {
			if(mp[ff[j]] != -1) 
				add(cur, 0, T - 1, mp[ff[j]], j - mp[ff[j]]);
			rt[i][j] = node(cur, j + 1), mp[ff[j]] = j;
		}
		hsh[i] = query(cur, 0, T - 1, 0, sz(s[i]) - 1).sum; 
	}
	
	int xlen = 0, as = 1;
	L(i, 1, n) 
		xlen += sz(s[i]), as &= sz(s[i]) == sz(s[1]);
	if(xlen <= 1000 || q == 1 || as) 
		return solve1(), 0;
	
	assert(false);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 169ms
memory: 395952kb

input:

0 2 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1
1
1
487
1
0
1
487
0
1
0
0
1
1
1
0
487
0
0
1
487
1
1
1
1
487
1
0
0
0
487
487
1
1
487
487
1
0
1
0
1
0
0
487
1
0
1
0
1
1
487
1
1
1
1
1
1
0
1
0
0
0
0
0
0
487
0
1
1
0
1
0
0
1
0
487
487
487
1
1
487
487
1
1
1
1
1
487
0
487
0
0
0
487
0
1
487
487
1
1
1
0
0
1
1
487
1
1
0
1
1
1
1
1
1
487
1
1
0
1
1
0
0
1
0
1
...

result:

ok 500000 tokens

Test #2:

score: 0
Accepted
time: 155ms
memory: 395900kb

input:

0 2 500000
bbbbaaabbabababbbabaaaabaaabbaababbababaababbaabbaabbaaabbabaaabbbabbabaaaaabbbabbbaabbabbbaabaaaaabbbbabaaabbbbbbbabaaaabaaabbbbabbbababaaaababaaababbbbbababbbbbababbbaababbabbabaaaabbbaaabaabbbbaabaabaabbaaabbaabaaabbaaaabbaabbaabbbbaaabbbbabababaaabbbbaaaaababaaaababbbbbababababaaaabba...

output:

1
999
1
999
1
999
1
0
1
1
0
1
0
999
0
1
1
0
999
0
1
1
1
1
999
999
999
1
1
1
1
1
1
1
1
999
0
999
999
999
1
0
1
999
0
999
1
999
1
0
999
1
0
1
1
999
0
1
0
999
999
1
999
999
1
0
1
999
1
1
1
1
1
1
1
999
0
0
1
999
1
1
1
1
1
1
1
999
0
999
1
0
1
1
1
1
999
1
999
1
1
1
0
1
0
999
0
999
0
0
0
0
1
1
999
999
1
0
...

result:

ok 500000 tokens

Test #3:

score: 0
Accepted
time: 174ms
memory: 396560kb

input:

0 10 500000
baaaaabbaabbabbbbbbaabbbbaaabaaaaabbaaaaabaabaabaaaaaabababbaabababbaabaaaaaaabbbbaabbaaaabbbbaaaaaaaaaaaaabbaabbababaababbababbaaaabaaabaabbaaaabbaaabababbabbbaabbabbaaaabbaaaababbabaabbaabbbabbbbababaabbbaaabaaaabbbaabbabbaaababbbaababaabbbbbbaabaabbbabbabbbabaaabaaabbabbaabbabaaabaaaa...

output:

1
0
0
0
0
225
0
0
0
0
0
0
0
0
0
0
1
35
0
0
1
1
30
0
0
0
0
0
18
0
0
0
0
0
0
0
0
0
16
0
0
3
0
0
1
0
0
0
1
0
1
0
0
0
0
54
50
0
1
0
0
0
1
5
0
0
0
63
0
50
175
109
0
0
0
0
0
0
0
0
0
0
1
175
3
109
0
0
0
35
0
0
0
0
0
0
0
0
0
0
50
0
4
0
0
0
0
0
3
0
18
0
0
0
35
301
0
0
0
0
0
0
35
0
0
175
0
0
1
1
0
0
0
0
1
0
0...

result:

ok 500000 tokens

Test #4:

score: 0
Accepted
time: 169ms
memory: 397624kb

input:

0 30 500000
ababbababaabaababaaabbaaabbabaabababaaaababbaaababba
abaababaaababaabaabbb
baba
aaabbaaabbaaabbaa
ab
bbbbbaabbababbaabaaba
bbbbbbabbbbaaaaabaabbaabbabbbaaaaaaaaaabaabb
bbb
bba
baaaaaaabbbababbbaaaabbbba
aaabaaaaaaabbbabaaabaaaabbbbabbaabbbaabbbaabaaaaabbabbbabbbabbaaabbbbbbbbabaabbbaabbb...

output:

26
0
0
0
0
0
33
0
0
16
0
1
0
14
0
0
1
0
0
6
4
26
1
0
6
0
14
0
0
50
0
1
0
1
11
0
0
0
0
0
3
0
0
1
0
0
0
0
0
0
0
10
0
3
0
0
2
1
0
0
16
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
3
0
6
0
0
0
165
2
0
0
0
0
0
0
0
0
0
13
0
0
0
36
0
2
10
0
0
1
0
0
0
0
0
36
0
0
14
0
0
0
0
0
2
2
0
0
0
6
1
2
0
1
0
0
13
0
0
1
18
0
0
0
0
0
0...

result:

ok 500000 tokens

Test #5:

score: 0
Accepted
time: 229ms
memory: 396104kb

input:

0 100 500000
a
aba
aaa
aababbbaaaabbabba
abaaabb
babbabbabbaa
bbbb
baaabb
aaaababbbabbaababaa
babaabbab
ababbabab
aaaba
baaabbaabaabb
abbababbaababbabaabbbaaaaabababaabab
ba
bb
aaabbbbbbb
a
bbabaaabababbaa
aab
bba
aaa
abb
b
bbbbab
abab
bbaab
bbbabbbabbbabaabbabb
ababa
bb
babaaaaaaaaaaaabaabaaaaaa
ba...

output:

1
0
0
0
0
0
0
37
13
0
0
0
0
2
0
1
0
0
5
0
0
0
0
0
2
10
0
0
7
0
0
3
0
0
3
0
3
0
0
3
13
0
0
2
0
0
0
0
8
5
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
27
0
5
3
0
0
1
0
0
0
6
0
0
3
0
0
0
0
0
0
0
2
2
0
0
5
0
9
0
0
0
6
0
0
0
0
0
0
0
0
6
0
0
0
1
5
21
0
8
0
0
0
0
0
0
0
0
0
0
0
2
2
0
0
0
1
0
0
1
2
0
0
3
0
0
0
0
1
0
25
8
1...

result:

ok 500000 tokens

Test #6:

score: 0
Accepted
time: 155ms
memory: 395484kb

input:

0 10 500000
dwufssiqlihcwjeunletiposagglzrtaebzfwarrgxpffcgdfjlkyaiaprxqtlnmdweczqpbcqppbaeghojhodqyicl
dskgaujjtcaaiobkallyeoyddhqgfsrpyghyqnpxihmlyg
qwpqdmsygfqpyotyqayhprdccctiunclkqeguxmlvplrxauwxwdccmfepmrivspacjlkncuylibvguvqvncoykwtjuxorgiiqpmotlhmkmqdaxtiiqamskzledzucczsygneqrmzrikhffuqbclgf...

output:

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

result:

ok 500000 tokens

Test #7:

score: 0
Accepted
time: 146ms
memory: 396460kb

input:

0 30 500000
zfypsxangtebfdztifwcdgdzo
qtxczqnulhrscugzkghnmwzviuwlpwjvqdrqdectpvnpyjzxgzlkainkoekbmn
ilec
joqqzftazpykqlhnvualkp
bfhpanqhkctymdmwutvzrmvanfwippyqaowidnqzzbrvyhdahjayzkvwbohilzbwshkvmjsxrxyrzodwdk
mwcnzm
wyoujkavpsopsxkgdhqxrvdj
nruhek
jaannpkquuayfyhagnjydj
bcfdanjogbtyhexqqahovggcli...

output:

0
0
4
0
16
0
0
0
0
1
0
3
0
1
0
22
0
0
3
0
0
0
0
67
169
22
0
39
0
0
14
0
22
69
0
0
0
0
0
0
0
0
0
0
0
8
51
0
0
0
0
0
0
0
0
0
6
3
0
0
15
0
15
0
0
0
0
0
0
0
18
0
0
0
15
1
0
0
0
1
69
0
0
0
1
0
0
59
0
0
0
0
0
0
0
0
0
18
16
0
0
0
0
0
33
0
11
0
0
2
16
60
0
56
0
0
0
0
0
5
0
1
0
0
0
0
18
0
0
1
0
46
0
2
0
0
0
...

result:

ok 500000 tokens

Test #8:

score: 0
Accepted
time: 188ms
memory: 396356kb

input:

0 100 500000
f
vctmhqmlcvwadkbtiptgiynjdrv
klnurfsks
mdtew
w
dobxagftzyiep
aigx
ku
vgx
hlmmtvh
gf
vm
inbaj
hlugbhc
xkmdikabexzvkhkvjl
tiglgdhvmzeibfnt
deofjsoxepazkrbmthsebbnylmcptldzvqyfqpolfimoiux
brh
rc
mvvwq
jjzhgrmoxxlrkm
uawxorf
bixvlsfqjnufva
oq
fiemitnd
ezybml
nmckgblttqyq
lldyiyulzinj
sdvog...

output:

0
4
17
0
0
0
0
0
41
4
0
11
0
1
0
0
8
0
2
0
21
2
0
4
2
3
0
0
0
0
0
0
0
0
0
15
9
13
22
0
0
0
0
0
1
0
0
6
6
1
0
0
0
0
1
0
1
5
6
0
1
0
0
10
0
0
17
0
13
0
0
3
0
0
0
1
0
9
21
0
0
0
1
6
0
1
0
10
0
0
0
0
0
2
53
0
7
0
0
5
2
13
19
2
0
0
4
7
0
0
32
0
0
0
0
6
0
8
0
5
0
5
0
0
0
0
0
0
0
7
0
0
1
26
32
0
1
8
0
0
6
...

result:

ok 500000 tokens

Test #9:

score: 0
Accepted
time: 381ms
memory: 414968kb

input:

0 1000 500000
o
i
k
p
e
o
h
v
g
p
v
h
f
v
r
j
j
u
b
x
s
s
l
v
e
x
o
i
b
r
b
k
z
a
v
k
j
i
o
g
r
c
n
x
j
t
p
r
c
r
i
u
k
n
s
s
o
f
c
y
x
i
a
o
p
g
q
n
d
j
t
c
h
s
w
e
q
z
w
e
k
p
q
c
z
d
c
j
w
f
p
w
e
i
v
i
r
p
f
s
a
v
u
v
n
l
y
s
n
v
r
c
h
k
n
m
e
m
t
g
t
f
x
g
q
l
v
f
g
l
i
y
w
t
h
x
y
j
q
o
b
b
o
...

output:

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

result:

ok 500000 tokens

Subtask #2:

score: 15
Accepted

Test #10:

score: 15
Accepted
time: 602ms
memory: 474724kb

input:

0 500000 500000
v
s
o
w
f
c
z
u
d
b
z
h
b
e
w
p
n
l
e
i
e
h
g
h
o
q
u
x
n
k
t
z
i
f
e
t
q
b
s
h
o
q
k
n
k
t
d
x
t
u
p
w
l
h
g
j
c
q
n
i
s
o
v
s
u
e
n
c
j
f
u
w
q
g
u
p
v
w
z
w
p
r
d
n
m
v
d
z
n
j
l
o
n
v
y
u
j
x
j
v
a
e
x
r
l
s
x
g
u
a
h
u
c
b
z
k
b
t
g
h
o
g
k
t
l
u
i
c
q
p
v
c
s
s
s
l
i
c
h
t
o
s
...

output:

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

result:

ok 500000 tokens

Test #11:

score: 0
Accepted
time: 565ms
memory: 450700kb

input:

0 250000 500000
di
ne
pk
cw
la
bt
cx
hs
ku
ga
rq
zq
jo
zr
at
ue
og
sl
su
ju
gy
oo
om
ev
df
bm
jh
um
vw
ts
qs
we
pn
pe
zc
zb
nl
ld
kl
pl
tk
uh
cm
hn
qb
xi
wb
lu
kq
gf
vc
eq
xe
ni
se
ng
kn
rt
zd
bv
vb
vn
ui
dz
kn
do
cg
nn
ct
mz
op
od
lu
cb
ra
ib
dk
lh
xh
wh
ny
ws
jw
lh
vk
bl
ak
an
rz
xv
sm
zt
mp
yr
an...

output:

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

result:

ok 500000 tokens

Test #12:

score: 0
Accepted
time: 463ms
memory: 434784kb

input:

0 50000 500000
qkubvtpdzm
soafdgztoz
dzihbjgzlv
qzmgwddcum
edjlwzdesz
uzdcradqvu
keljvoztlv
rwibigjyiq
txgwbogpxx
hpkzemjevp
zgygtmqivo
vmhpsomqgj
icjqyepuzv
lgxnfnvmnk
wgetijbyql
qsglhyjkee
enfkhyfory
hwzrhlcqfj
bhifrgvfly
bpuphqsvau
yvdgurwpeo
vxyypvbpfh
ghgrliyqyb
vaunorfwvl
xzisdbfkbu
vpxuecgonr...

output:

0
0
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
0
0
0
1
0
0
1
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
...

result:

ok 500000 tokens

Test #13:

score: 0
Accepted
time: 483ms
memory: 432904kb

input:

0 5000 500000
wgnhspqfqmsglvytlzswiyhhryunyqtbwgrybapsfazarmqfzeyaqheruzccfiwvosvttasxklvfyiyutasgnqzielbmzfwzneea
ksqsaughjpdpmrxyqrnkenvuhhbnxjlgaxoebfgosierjxuhbxxnnupigxqjcmknzuomavqyafbwippqznniqixbbutybznxxlcg
jqhxhvoknjktzdegmtdvxapbfobchmgvxavvbksiqekqtjkvvgwkfxsuqueklxlyqlanorcambowdgzvdovf...

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 500000 tokens

Test #14:

score: 0
Accepted
time: 274ms
memory: 414976kb

input:

0 200 500000
ztvrelbmgkwawltubkecueenrrxoafbslwjaeqvzzppfzxvgycgliaiwhfeyvodpsapqeyjirgclwrdflcqispbtbivlkaiecakocarlmhpdowzwjhxgpjbcccepmpceyyrwwrnmlyyioslgqbppnutbqcxhiyfntvxwslcpqnvmonyevbadqpkhlddixawynfoztkjmfsafyoolgspflnixalfeulgtuymhzpeutrquxqnkhwhezovdksbthwzirpdnhinlvnjijtytwzggcoptflsjhbl...

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
1
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 500000 tokens

Test #15:

score: 0
Accepted
time: 207ms
memory: 411400kb

input:

0 20 500000
tzfbewglzikwxyjkkathrpoidnvdudkwosfrlcnmhvoyjniwveiypahkpychzwseqsvssdqbzxkixatwwsuigjygtoxehabbsioeberecmqzmagaancqugaaxqblwleoglexgeobzhidsqydsgyhtncuhdyavcknynbeisqebyagzpengdavedutrwejzcrfpacgvohrjshpsiubwqufuaqrwzcyothsesstsjyldiddejmgpcefjbshtbojbbkytitfibgiabeonnysfswnqwkwqmaurtbe...

output:

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

result:

ok 500000 tokens

Test #16:

score: 0
Accepted
time: 153ms
memory: 417240kb

input:

0 1 500000
xbfaqwhxainvubbxblsgiyhxchubsocqkdjomtvxiwrxiytdshewrcfjjxelnrdsmrjphysgoiugosyghdtmjzrzrzjkzbuyxjicfeaggqfhwleuekeldzxamxdhpfgxtlwdehoarxjxshtqyhtwehgirhdqvkxoxstpiltckqaliambfrrnighbdireuuddwgidywbazdfrclivpynyjmtwmedhowwigqcslfadgqwzqxlxhumfkbnutalszwrofjlhhfxkcazgxzpooxlgyoalhqpnmklgc...

output:

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

result:

ok 500000 tokens

Test #17:

score: 0
Accepted
time: 738ms
memory: 488160kb

input:

0 100000 500000
thjjy
hhhhp
nnnnn
ssssz
ttttx
xxxxx
yyyyy
yyyyy
sssss
qqqqn
ooooo
uuuuu
yyyyo
eeeee
ttttt
wwwww
bbbbb
ttttt
zzzzz
lllll
vvvvv
wwwww
xxxxx
hhhhh
lllll
nnnnn
ccccc
nexxj
yyyyq
iiiii
mmmmm
qqqqq
kkkkk
wwwww
ooooo
yyyyy
uuuuu
kkkkk
iiiih
ggggg
qqqqq
eeeee
ooooo
wmuuz
ooooo
sasss
gkffo
eu...

output:

1
0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
0
1
1
1
1
1
1
0
1
0
1
0
1
1
0
0
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
1
1
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
0
...

result:

ok 500000 tokens

Test #18:

score: 0
Accepted
time: 713ms
memory: 494496kb

input:

0 50000 500000
uuuuuuueeu
yyyyyyyyqq
oooooooooo
qqqqqqqqqq
nnnnnnnnnn
nnnnnnnnnn
pppppppepp
lldldmjmmm
qqqqqqqqqq
sssssssuus
ppkzkrjrrr
ggvgvsdsss
ffffffffff
mmmmmmmmmm
oooooooooo
aaaaaaaaaa
aaaaaaaahh
fffffffvff
dddddddddd
cccccccccc
xxxxxxxexx
eeeeeeesse
wwwwwwwwww
bbbbbbbbbb
uuuuuuuuuu
eeeeueeeee...

output:

0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
0
1
1
1
1
0
0
0
1
1
0
0
1
0
0
1
0
0
1
0
1
1
1
1
0
0
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
1
...

result:

ok 500000 tokens

Test #19:

score: 0
Accepted
time: 682ms
memory: 500580kb

input:

0 5000 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaadaaaaadaaaaaaaaaaaaaaaaaaddaaaaaaaaadaaaaaaaaaddaaddaaaaaaaaad
rrwwwwwqnhnhhhuhhuppppuhuuwuuuuwuduzzuuuzzmxmtmmoaaojrneenneeeeeyqyeyvkkilhyyybzzzbiiibmbsvfvvfvlvvj
uukkkkkwfcfcccgccgaaaagcggdggggdgrgmmgggmmwlwkwwgzzgtvjbbjjbbbbbtqtbtriiwyadddcooocy...

output:

1
0
0
0
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
1
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
1
...

result:

ok 500000 tokens

Test #20:

score: 0
Accepted
time: 553ms
memory: 488728kb

input:

0 500 500000
llllllllllllllllnmnnnnmnnnnmnlllllllnnllnnbnnlllnnbbnnbnnbbnnnbbnnbnnbbbnnbbbnynbnbbnbnbbtbbtbbnbbtbbttbttbbtbbttbttbxxbtttbxkxkkxkxkkxkkxkxkxxkkxaxaaakkakkakkaakkkaakkkaaaakkkkaaaakkkaakkkakkkaakaaaaaakkakkaaakkakkaakkakkaakaakkakakakakkaakakakaiiakkkakalakakkkakalakkalaalhlallaalllaal...

output:

0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
...

result:

ok 500000 tokens

Test #21:

score: 0
Accepted
time: 289ms
memory: 470896kb

input:

0 20 500000
hhzhhhhzhhhhxhhggpgggpgollooooomrmmrbrmjjiijjijijijijjjhhhjjhjwwjhhbbhhhhbpswswswswadadaaddlddaqqaooooarajzjzjajzjzjjzzjzjzjjjzzjaaoahfmqmihhhhimmihhiiooiihhghvhhvvevevevvkkkvvdiddpdejjggsshsbssszszszvpkykkkbbkkhvhhhvhvkkmccccccjjcjyjjyyfynyfxxfxffxffbjnnzlzznnllnlnprddlzfzlzzzzzkkkklalq...

output:

0
0
1
1
0
0
0
0
0
1
0
0
0
1
0
1
1
1
0
1
0
0
1
0
0
0
0
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1
1
0
1
0
0
0
1
1
1
1
0
0
1
0
1
1
1
1
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
0
1
0
1
1
1
1
0
0
0
1
...

result:

ok 500000 tokens

Test #22:

score: 0
Accepted
time: 319ms
memory: 493584kb

input:

0 5 500000
ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...

output:

0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
0
0
0
1
1
1
1
0
0
0
1
0
0
1
1
0
0
1
0
0
1
0
1
0
1
1
1
0
0
0
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
0
0
1
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
1
0
0
1
0
1
1
1
0
...

result:

ok 500000 tokens

Test #23:

score: 0
Accepted
time: 369ms
memory: 496956kb

input:

0 5 500000
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzpzzzzz...

output:

0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
1
1
0
1
1
1
1
1
0
0
1
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
0
1
1
1
0
1
1
1
0
0
0
1
1
0
0
0
0
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
1
1
0
0
0
0
0
0
1
1
...

result:

ok 500000 tokens

Test #24:

score: 0
Accepted
time: 323ms
memory: 492656kb

input:

0 5 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

1
1
1
1
0
1
0
1
0
1
0
1
1
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
1
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
0
0
1
1
0
0
0
1
1
0
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
1
0
0
...

result:

ok 500000 tokens

Test #25:

score: 0
Accepted
time: 306ms
memory: 510264kb

input:

0 2 500000
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

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

result:

ok 500000 tokens

Test #26:

score: 0
Accepted
time: 308ms
memory: 507988kb

input:

0 2 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

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

result:

ok 500000 tokens

Test #27:

score: 0
Accepted
time: 296ms
memory: 511512kb

input:

0 2 500000
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

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

result:

ok 500000 tokens

Test #28:

score: 0
Accepted
time: 307ms
memory: 510552kb

input:

0 2 500000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

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

result:

ok 500000 tokens

Test #29:

score: 0
Accepted
time: 313ms
memory: 510776kb

input:

0 2 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

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

result:

ok 500000 tokens

Test #30:

score: 0
Accepted
time: 304ms
memory: 511308kb

input:

0 2 500000
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu...

output:

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

result:

ok 500000 tokens

Test #31:

score: 0
Accepted
time: 288ms
memory: 539792kb

input:

0 1 500000
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

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

result:

ok 500000 tokens

Subtask #3:

score: 20
Accepted

Test #32:

score: 20
Accepted
time: 229ms
memory: 534572kb

input:

0 1 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok "1"

Test #33:

score: 0
Accepted
time: 219ms
memory: 505340kb

input:

0 2 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok "1"

Test #34:

score: 0
Accepted
time: 369ms
memory: 522196kb

input:

0 2 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

300001

result:

ok "300001"

Test #35:

score: 0
Accepted
time: 281ms
memory: 512132kb

input:

0 2 1
bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...

output:

33334

result:

ok "33334"

Test #36:

score: 0
Accepted
time: 368ms
memory: 522108kb

input:

0 2 1
bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...

output:

100001

result:

ok "100001"

Test #37:

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

input:

0 2 1
bcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcde...

output:

20001

result:

ok "20001"

Test #38:

score: 0
Accepted
time: 372ms
memory: 523720kb

input:

0 100 1
a
j
w
z
m
h
d
n
f
c
k
z
f
c
m
d
v
o
e
w
t
r
j
j
e
l
q
q
m
y
a
a
q
g
i
e
y
p
k
x
c
q
t
b
c
r
l
n
e
t
x
d
x
w
a
a
p
g
e
v
x
o
r
v
e
n
t
s
t
x
u
y
l
x
bcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaa...

output:

74976

result:

ok "74976"

Test #39:

score: 0
Accepted
time: 194ms
memory: 435540kb

input:

0 2 1
epppipfhwh
wnybdiecccdcqdrdyrrrzrxizicvvvrvoxpxnpppspbnknmuuupuykckegggqgwctclhhhihvonooxxxrxwujuussswsxltlujjjpjxysyudddydrqeqozzzgznsislcccjcqlilyjgfxccctchvlvqfffhfvcpcyrrrqrstntomxvvvmvgprpawwwpwnjmjyjjjdjpbnbevvvovadmdrzzzpzothtekfffaflnwngkkkxkycncczzzgzsgvgldddjdnqmqyzzzbzwmhmmaaahawrvr...

output:

47042

result:

ok "47042"

Test #40:

score: 0
Accepted
time: 282ms
memory: 481264kb

input:

0 2 1
eoaxlzjsyyyysyyyysysyysyssysyysyssyysyyssysyssyyssysyssyysyyssyyssyysyyssyysssyyssyysyysssyysssysyysysssyyssavvhuqyhpetbpcplkobyavffffnffffnfnffnfnnfnffnfnnffnffnnfnfnnffnnfnfnnffnffnnffnnffnffnnffnnnffnnffnffnnnffnnnfnffnfnnnffnnbbbbsbbbbsbsbbsbssbsbbsbssbbsbbssbsbssbbssbsbssbbsbbssbbssbbsbbs...

output:

4748

result:

ok "4748"

Test #41:

score: 0
Accepted
time: 346ms
memory: 482812kb

input:

0 2 1
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

13476

result:

ok "13476"

Test #42:

score: 0
Accepted
time: 365ms
memory: 521536kb

input:

0 2 1
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

47

result:

ok "47"

Test #43:

score: 0
Accepted
time: 343ms
memory: 522724kb

input:

0 2 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

4

result:

ok "4"

Test #44:

score: 0
Accepted
time: 248ms
memory: 480336kb

input:

0 3 1
bbbbabaaabbaaaaabbbbabbabaabbbaaabaababbbabbaababbaaaababbaabbbaabbbababbbbbbababaaababbbbaabaabbaaaabaaabaabaabbbabaabaabbbaaaabaabbabababbaabbaaaaaababbbbabbabbaabaaabaabbbbaababbaabababbaabaaabbaabababbaabaaaababababababbaaaababbbabbababbbabaaaabababbaaabbaaabababbaaaabaaababbbaabaabbababba...

output:

0

result:

ok "0"

Subtask #4:

score: 0
Dangerous Syscalls

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #45:

score: 0
Dangerous Syscalls

input:

0 50000 500000
bbbaa
a
abbaabbba
bbbbbaababbbbaabbbbbaaabababbbbbbabbbba
b
a
abaabb
bbbaba
ababbab
abbbba
bbabab
b
aabb
bab
ab
abaabaaabaabababbbaaabaabbbaabbbbaaaaa
babba
babaaabbabbb
bbaab
abb
babbbbaaabbbbbbbab
aaabbababbbbbbbabbbba
bbaabbabababaa
bbbbaaaaababbabaa
bbbaaababbbb
ababbababbababaaaa...

output:


result:


Subtask #5:

score: 0
Skipped

Dependency #4:

0%