QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#251943#7776. 超现实树zhoukangyang100 ✓645ms83880kbC++119.7kb2023-11-15 13:33:092023-11-15 13:33:09

Judging History

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

  • [2023-11-15 13:33:09]
  • 评测
  • 测评结果:100
  • 用时:645ms
  • 内存:83880kb
  • [2023-11-15 13:33:09]
  • 提交

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(f, x) memset(f, x, sizeof(f))
#define uint unsigned int
#define ull unsigned long long 
#define i128 __int128
using namespace std;
const int N = 1 << 18;
int n, m;
vi e[N];

int siz[N], root, fn;
int vis[N];
void gsz(int x, int f) {
	siz[x] = 1;
	for(auto&v : e[x]) if(v != f && !vis[v]) {
		gsz(v, x);
		siz[x] += siz[v]; 
	}
}
inline void findrt(int x, int f) {
	int mx = 0;
	for(auto&v : e[x]) if(v != f && !vis[v]) {
		findrt(v, x);
		mx = max(mx, siz[v]);
	}
	mx = max(mx, fn - siz[x]);
	if(mx <= fn / 2) {
		root = x;
	}
}

namespace Hash {
const ll mod = (ll) 998244353 * 1019260817, base = 19491001;
ll Mul(ll a, ll b) {
	return (__int128) a * b % mod;
}
ll Add(ll a, ll b) {
	return (a + b) % mod;
}
ll Dec(ll a, ll b) {
	return (a + mod - b) % mod;
}
ll pw[N];
void init(int x) {	
	pw[0] = 1;
	L(i, 1, x) pw[i] = Mul(pw[i - 1], base);
}
}

struct oper {
	int op;
	int val;
	oper(int OP = 0, int VAL = 0) {
		op = OP;
		val = VAL;
	}
};

struct ds {
	int rev;
	char val[N];
	
	ll wn[N];
	int sz[N], beg[N];
	int mst[N];
	
	vi lstk, rstk;
	int ban, must, curv;
	vector < oper > ops;
	
	ll hsh[N];
	void clear(int x) {
		hsh[1] = 1919810;
		ops.clear();
		ban = 0;
		lstk.clear();
		rstk.clear();
		must = -1;
		curv = 0;
	} 
	
	void pop_r() {
		ops.emplace_back(oper(1, rstk.back()));
		rstk.pop_back();
	}
	
	void add_cur(int w) {
		ops.emplace_back(oper(2, w));
		curv += w;
	}
	
	void add_rsk(int w) {
		ops.emplace_back(oper(3, w));
		rstk.back() += w;
	}
	
	void pb_lsk(int w) {
		ops.emplace_back(oper(4, w));
		lstk.emplace_back(w);
		if(sz(lstk) > 1) {
			int n = sz(lstk);
			if(rev) {
			hsh[n] = Hash :: Add(hsh[n - 1], 
				Hash :: Mul(lstk[n - 1] - lstk[n - 2] + 114514, Hash :: pw[n]));	
			} else {
			hsh[n] = Hash :: Add(hsh[n - 1], 
				Hash :: Mul(lstk[n - 2] - lstk[n - 1] + 114514, Hash :: pw[n]));
			}
		}
	}
	
	void pb_ban(int w) {
		ops.emplace_back(oper(5, ban));
		ban = w;
	}
	
	void pb_must(int w) {
		ops.emplace_back(oper(6, must));
		must = w;
	}
	
	void pb_rsk(int w) {
		ops.emplace_back(oper(7, w));
		rstk.emplace_back(w);
	}
	
	void mark(int x) {
		if(ban) return ;
		if(val[x] == '|') {
			if(!sz(rstk)) {
				add_cur(1);
			} else {
				add_rsk(1);
			} 
		}
		
		if(val[x] == '}') {
			if(!sz(rstk)) {
				pb_lsk(curv);
				add_cur(-curv);
				return ;
			}
			int u = rstk.back();
			if(must != -1 && must != u) 
				pb_ban(1);
			pb_must(u);
			pop_r();
		} 
	
		if(val[x] == '{') {
			pb_rsk(0);
		} 
	}
	void make(int x) {
		if(!sz(rstk) && !curv && !ban) {
			mst[x] = must;
			sz[x] = sz(lstk);
			beg[x] = -1;
			if(sz[x]) {
				beg[x] = lstk[0];
			}
			wn[x] = hsh[sz[x]];
		} else {
			mst[x] = -2;
		}
	}
	void getv(int x, int f) {
		mst[x] = -2;
		int SZ = sz(ops);
		mark(x);
		make(x);
		for(auto&v : e[x]) if(v != f && !vis[v]) {
			getv(v, x);
		}
		while(sz(ops) > SZ) {
			auto tp = ops.back();
			if(tp.op == 1) {
				rstk.emplace_back(tp.val);
			} else if(tp.op == 2) {
				curv -= tp.val;
			} else if(tp.op == 3) {
				rstk.back() -= tp.val;
			} else if(tp.op == 4) {
				lstk.pop_back();
			} else if(tp.op == 5) {
				ban = tp.val;
			} else if(tp.op == 6) {
				must = tp.val;
			} else if(tp.op == 7) {
				rstk.pop_back();
			}
			ops.pop_back(); 
		}
	}
} d1, d2;
vi CUR;
void Getsiz(int x, int f) {
	CUR.emplace_back(x);
	for(auto&v : e[x]) if(v != f && !vis[v]) 
		Getsiz(v, x);
}

int sum[N];
vi roots[N];

ll ans[N];
namespace FFT {
	const double pi = acos(-1);
	struct CP {
		double x, y; 
		CP (double xx = 0, double yy = 0) {
			x = xx, y = yy;
		}
		inline CP rev() {
			return CP(x, -y);
		}
	} ;
	inline CP operator + (CP aa, CP bb) {
		return CP(aa.x + bb.x, aa.y + bb.y);
	}
	inline CP operator - (CP aa, CP bb) {
		return CP(aa.x - bb.x, aa.y - bb.y);
	}
	inline CP operator * (CP aa, CP bb) {
		return CP(aa.x * bb.x - aa.y * bb.y, aa.x * bb.y + aa.y * bb.x);
	}
	CP Pow[N], iPow[N];
	int Lim, pp[N], lim;
	void revlim() {
		L(i, 0, lim - 1) pp[i] = ((pp[i >> 1] >> 1) | ((i & 1) * (lim >> 1)));
	}
	void up(int x) {
		for(lim = 1; lim <= x; lim <<= 1) ;
	}
	void FFT(CP *f, int flag) {
		L(i, 0, lim - 1) if(pp[i] < i) swap(f[pp[i]], f[i]);
		for(int i = 2; i <= lim; i <<= 1) {
			for(int j = 0, l = (i >> 1), ch = Lim / i; j < lim; j += i) {
				for(int k = j, now = 0; k < j + l; k++) {
					CP pa = f[k], pb = f[k + l] * (flag == 1 ? Pow[now] : iPow[now]);
					f[k] = pa + pb, f[k + l] = pa - pb, now += ch;
				}
			}
		}
		if(flag == -1) L(i, 0, lim - 1) f[i].x /= lim, f[i].y /= lim;
	}
	void init() {
		Lim = 1 << 17;
		auto c = CP(cos(2 * pi / Lim), sin(2 * pi / Lim));
		auto tc = CP(cos(2 * pi / Lim), -sin(2 * pi / Lim));
		Pow[0] = iPow[0] = CP(1, 0); 
		L(i, 1, Lim) 
			Pow[i] = Pow[i - 1] * c;
		L(i, 1, Lim) 
			iPow[i] = iPow[i - 1] * tc;
	}
	CP ls[N], rs[N];
	void mul(int *a, int *b, int mxa, int mxb) {
		lim = 1;
		for(; lim <= mxa + mxb; lim *= 2); 
		revlim();
		L(i, 0, lim - 1) 
			ls[i] = rs[i] = CP(0, 0);
		L(i, 0, mxa) 
			ls[i] = CP(a[i], 0);
		L(i, 0, mxb) 
			rs[i] = CP(b[i], 0);
		FFT(ls, 1);
		FFT(rs, 1);
		L(i, 0, lim - 1) 
			ls[i] = ls[i] * rs[i];
		FFT(ls, -1);
		L(i, 0, mxa + mxb) 
			ans[i] += round(ls[i].x);
	}
}
int cnts[N];

int cl[N], cr[N];

int mul_l[N], mul_r[N];
void dc(int x) {
	gsz(x, 0), fn = siz[x], root = 0, findrt(x, 0);
	x = root, vis[x] = 1;
	
	priority_queue < pair < int, int > > q;
	sum[x] = 1, roots[x] = vi{x}, q.push({-sum[x], x}); 
	d1.clear(x), d2.clear(x);
	d1.mark(x), d1.make(x), d2.make(x);
	for(auto&v : e[x]) if(!vis[v]) {
		CUR.clear(), Getsiz(v, x), sum[v] = siz[v], roots[v] = CUR, q.push({-siz[v], v});
		d1.getv(v, x);
		d2.getv(v, x);
	}
	
	while(sz(q) > 1) {
		int u = q.top().second;
		q.pop();
		int v = q.top().second;
		q.pop();
		 
		L(cms, 0, 1) {
			
		vi Lp, Rp;
		for(auto&a : roots[u]) if(d1.mst[a] != -2) 
			Lp.emplace_back(a);
		for(auto&b : roots[v]) if(d2.mst[b] != -2)
			Rp.emplace_back(b);
		
		unordered_map < ll, pair < vi, vi > > mp;
		for(auto&a : Lp) 
			mp[d1.wn[a]].first.emplace_back(a);
		for(auto&b : Rp) 
			mp[d2.wn[b]].second.emplace_back(b);
			
		for(auto&s : mp) {
			vi l = s.second.first;
			vi r = s.second.second;
			if(!sz(l) || !sz(r))
				continue; 
			int have_size = d1.sz[l[0]];
			if(!have_size) {
				unordered_map < int, pair < int, int > > MP;
				ll gl = 0, gr = 0;
				for(auto&u : l) 
					if(d1.mst[u] != -1) 
						MP[d1.mst[u]].first += 1;
					else 
						++gl; 
				for(auto&u : r) 
					if(d2.mst[u] != -1) 
						MP[d2.mst[u]].second += 1;
					else 
						++gr;
				for(auto&s : MP) {
					ll hl = s.second.first;
					ll hr = s.second.second;
					ans[s.first] += hl * hr;
					ans[s.first] += hl * gr;
					ans[s.first] += gl * hr;
				}
				continue;
			}
			unordered_map < int, pair < vi, vi > > MP;
			vi tl, tr;
			for(auto&u : l) 
				if(d1.mst[u] != -1) 
					MP[d1.mst[u]].first.emplace_back(u);
				else tl.emplace_back(u);
			for(auto&v : r) 
				if(d2.mst[v] != -1) 
					MP[d2.mst[v]].second.emplace_back(v);
				else tr.emplace_back(v);
				
			for(auto&x : tl) 
				cl[d1.beg[x]] += 1;
			for(auto&x : tr) 
				cr[d2.beg[x]] += 1;
			for(auto&s : MP) {
				vi hl = s.second.first;
				vi hr = s.second.second;
				for(auto&r : hl) 
					cnts[d1.beg[r]] += 1;
				for(auto&r : hr) if(d2.beg[r] <= s.first)
					ans[s.first] += cnts[s.first - d2.beg[r]];
				for(auto&r : hl) 
					cnts[d1.beg[r]] -= 1; 
				
				for(auto&r : hl) if(d1.beg[r] <= s.first)
					ans[s.first] += cr[s.first - d1.beg[r]];
				for(auto&r : hr) if(d2.beg[r] <= s.first)
					ans[s.first] += cl[s.first - d2.beg[r]];
			}
			vector < pair < int, int > > ls, rs;
			for(auto&u : tl) {
				int x = d1.beg[u];
				if(cl[x]) 
					ls.emplace_back(x, cl[x]), cl[x] = 0;
			}
			for(auto&v : tr) {
				int x = d2.beg[v];
				if(cr[x]) 
					rs.emplace_back(x, cr[x]), cr[x] = 0;
			}
			sort(ls.begin(), ls.end());
			sort(rs.begin(), rs.end());
			int mxl = 0, mxr = 0;
			for(auto&u : ls) 
				mxl = max(mxl, u.first);
			for(auto&u : rs) 
				mxr = max(mxr, u.first);
			if((mxl + mxr) * log(mxl + mxr) <= (ll)sz(ls) * sz(rs)) {
				L(i, 0, mxl) 
					mul_l[i] = 0;
				L(i, 0, mxr) 
					mul_r[i] = 0;
				for(auto&u : ls) 
					mul_l[u.first] += u.second;
				for(auto&u : rs) 
					mul_r[u.first] += u.second;
				FFT :: mul(mul_l, mul_r, mxl, mxr);
			} else {
				for(auto&u : ls) 
					for(auto&v : rs) 
						ans[u.first + v.first] += (ll)u.second * v.second;
			}
		}
		
		swap(u, v);	
		}
		 
		for(auto&t : roots[v]) 
			roots[u].emplace_back(t);
		sum[u] += sum[v];
		q.push({-sum[u], u}); 
	}
	
	for(auto&v : e[x]) if(!vis[v]) 
		dc(v);
}

void dfs(int x, int p) {
	for(auto&v : e[x]) if(v != p) {
		dfs(v, x);
	}
}
int main () {
	Hash :: init(2e5);
	FFT :: init();
//	return system("fc matrix.out ex_matrix1.ans"), 0;
//	freopen("ex_matrix1.in", "r", stdin);
//	freopen("matrix.out", "w", stdout);
	ios :: sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	string S;
	cin >> S;
	L(i, 1, n) d1.val[i] = d2.val[i] = S[i - 1]; 
	L(i, 1, n) {
		if(d1.val[i] == '{') d1.val[i] = '}';
		else if(d1.val[i] == '}') d1.val[i] = '{';
	} 
	d2.rev = 1;
	L(t, 1, n - 1) {
		int u, v;
		cin >> u >> v;
		e[u].emplace_back(v);
		e[v].emplace_back(u);
	}
	dc(1);
	L(i, 0, m) cout << ans[i] << ' ';
	cout << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 16ms
memory: 60540kb

input:

4578 4576
|}}|}|{}{}|}|||{}}|}|||{|}||}}{}{{}|{{}|}}{}|{}{{}{{|{}}}|{||}||}}}}}|}}{||}|}{|{{}{}|{}{{}}}|{{}|}{}{}}}}}||}|}||||||{|}{}|}{|}{|}||}}}|}{{|}{{{}{}||{}}||}{}|}}{||{}}{}}|{|}{{|}}|{}||}}{}||}}|{|{{|}|{{}|{{{}}|||{}|||{{}}{||}{{|{{{{|{|}{|}{||}}}{{|}{}|{}}}{|}}{{|{|}{||{||||{|}}{{|}}{|||}}|...

output:

1736 642 213 88 42 16 8 1 1 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 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 4577 tokens

Test #2:

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

input:

4598 4596
||||||||}|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||{|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||{|||||||||||||||||||||||||||||||||||||||||||||||...

output:

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

result:

ok 4597 tokens

Test #3:

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

input:

4562 4560
}{}{{}{{{}}}}{{{{{}{{}{{{}}{{}{{{}}}{}{}}{}{{{{}}}{{}{{}}{{{{{{{{{{}}}{}}}}}{{{{{}}}}}{{}}{{}}{}{{}}{}{{}}}}}{{}}}}{{{}{}{}}{}{{{}}{{{{{{{}}}{}}}}}{}}{}{{}{}}}}{}{{{{}}}}{}{{}{}}}}{}}}{}}{{{}}}{{{{}}}}}}{}}{}}{}}{}{{{{}}}}{}{{{{{{{}}}{{{}}}}}{}{}}{}{}}}}{{{}}{}}}{{}}{}}{}}}}}{}}{{}}{}}}{{{...

output:

5094047 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4561 tokens

Test #4:

score: 0
Accepted
time: 10ms
memory: 56736kb

input:

4558 4556
||{{}{}|{}||}}}{||}{{|{|{|||{|}|}|}}}{{}|}}}|}}|{{|||{{|{}}{||}|{}}||||{||{||}|}{|}{||{{{{}||{}}{{}}|||}{}||{|}|{{{}|{|{{}}|}|}}}}|{{|{|}|}|{|}{{}}{}||{}{}||}}|}}|}{|}|{}|}|{|{{{}}}|{|{{{{}}|}{{||{|{{||||}}{|}|{|||{}}}}{{{|{{{|||{{|{{}|{||||}}}||||}}}|{|}}|}{{|}{{{{}{|||}{{|}}{|}{}{{}}}}{}...

output:

2009 734 273 142 84 39 10 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4557 tokens

Test #5:

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

input:

4560 4558
{}{{}}}{{{}}{{}}{{{}{}}}}}{{{}{{{}}{{}{{{}}{{}{{}}{}}|{}{{{{}{{}}{}{}}}}{{}|}}}{{}{}}}{}{{}}{}{}|}{{}{{{{{}}}}{{{}}{{{}}}}}}{}}{{{}}}}}}{}}{{}}}{}{{}{{}{}{}}}}}}}{{}}}}}}}}{}{}}{}{}}{{}{}}}}{}}}}}}{}{{{}}}{{}{|}{}}}{{}}}}{}{}{{{{}}{}{{}{}{}{}{{{}}{}}{}{}}}}{}{}{}}{}{{{{{}{}{{}}{}{}{}{}{}}}...

output:

11100 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4559 tokens

Test #6:

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

input:

4594 4592
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{...

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

Test #7:

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

input:

4561 4559
{}{{}{{}|{}{||}|}|{|{}|}}||{}||}}{||}}{{{{||}}}}|{|}}|||||{{|{|}}||{||{||{}}|{|{|{|}}||}{}{{}{|{}{{||}||||{|||}{}}}{}{{{{}}|}|}}}}|{}{|{|||{|||}{{{}}|}{}{{}{}|}}|{}|{|{}}{}{}}}|}|}{{}||{|}|}{}|}}}}|{}|}{{{}}{}|}}|}{{|{|}{{||{|}{|}}}}}{{||{}|{{{}{{|}}|{}}{}}}}}||}|{{{{{}}}||}||}|{{{{}}|}}{{...

output:

1828 565 244 83 27 11 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4560 tokens

Test #8:

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

input:

4579 4577
{}}}}}{{}}{{{}}{}{{{}}}}{{{{}{{{{{{{{{{{{{{{}{}{}{}{}{{}}}}{{{}}{}{}{}}}}{{}}{}{}}{{{{}{{{{{{}}{}{}{{{{}}}}}{}{}}}}{{{{{}}{}}}}}{{}}{}}{{}{}{}}{{{}{}{}}{{}{{{}}}{}}{{}{{{}}}}}}{}{}}{{{{}}{{{}}}{{{}}}{{{{}}}}{{}}{{}{{}}}{}{{{{}}}}}}{{{}{{{{}{{{}}{{}}}{{{}}{{}}{{{{}}{{}{}}{}{{}{}}{}{}}}{}}}}...

output:

26457 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4578 tokens

Test #9:

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

input:

4557 4555
{}}{{{}}}{}}{}}{}}}{{}}{{{}{}{}{}}}}{}{}}}{{}}{{{}}{}}}{{}{}}}{}{}}}}{{}{}{{}{{{{{}{{{{{}}{}}}}}{{{}{{}}{{{{{{{}{}}{{{}{}{{}}{{}{{{{{}{}{}}{{}}}}}{}{{{{}{}}{{}{}}}{{}{{{{{{}}{{}{}{{}{{{{}{}}}}{{{}{}}}{{{{{}}{}}{}{}{}{}}{}{{}{{}{{}{{}}}}}}}}{}}}}}}{{}{{}{}}}}}}{{{}{}{{}{}}{{}}{}}{{{}{{{}}}{...

output:

1411510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4556 tokens

Test #10:

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

input:

4586 4584
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||...

output:

0 1 3 4 3 1 2 1 1 0 1 3 2 2 2 2 1 2 1 0 0 1 1 2 2 2 2 1 0 1 0 1 2 2 2 0 3 1 2 1 1 1 2 1 0 0 2 1 0 3 1 0 0 0 0 1 3 3 5 3 1 3 1 2 2 3 3 2 1 2 2 1 1 2 2 0 0 1 2 1 1 3 1 0 1 0 1 1 1 2 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 1 2 1 1 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 ...

result:

ok 4585 tokens

Test #11:

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

input:

4596 4594
|}}}}|}}}|}}|}}}}|}}}}}|}|}|}}}}}|}}}||||}}|||}|}}|}}|||}|}|}|}|}|||||}}|}|}}|}|}}}}}}}}}}}}}}|}}}}}}||||}|||}}}}|}}}}|}|}|}|}}}|}|}}}}}||}}}}}|}||}}|}|}}}}||}}|}|}}|}||||||}}}}}||}||||}|}}}}||}}}}|||}|}|||}}}|||}}}}}|}}|||}|||}}}|}}||}|}}}}}||}}}||||}}|}|}|||}}}|}|}}|||||}}}|}}||}||}}||}}...

output:

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

result:

ok 4595 tokens

Test #12:

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

input:

4562 4560
}|}}}|}}}}}|}}}}}}|}}}}}}}}}}}}}|}}}}}}}}}}}}}|}}}}|}}}}}}}}}}}}|}}}}}}}}}|}}}}|}}|}}}}}|}|||}}}}}|}}}}|}|}}|}}}}}}}}}|}}}}}}}}}}}}}}}}}}}}}}|}}|}}}}}}|}}}}|}}}}}|}}}|}}}}}}}}}}|}}|}}}}|}}}}|}}}}}}}}}}}}}}}}|}}|}}}}}}}}}}}}}|}}}|}}}}}}}}}}}}}}}}}}}}}}}}|}}}}}}}}}}}}}}}}}}}||}}}}}}}}}}}}}}}...

output:

9 4 7 10 9 7 6 9 12 16 1 8 12 7 10 12 2 3 10 6 8 12 12 17 10 10 5 6 7 10 12 9 12 2 7 12 1 6 9 11 6 9 9 12 10 10 7 10 7 7 5 8 5 2 5 9 13 7 4 7 10 6 6 3 5 13 7 13 10 7 7 8 5 9 10 8 9 10 10 7 3 13 6 9 8 9 6 6 6 7 10 7 7 7 7 12 9 8 6 9 7 6 5 9 4 10 11 7 8 10 11 8 8 7 8 9 13 8 8 6 7 6 9 7 9 2 6 5 5 11 14...

result:

ok 4561 tokens

Test #13:

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

input:

4578 4576
|}|||||||||||||||||||}|||||||}||||}}|||||||||||||||||||}||||||||||||||||}||}||}|||||||||||||||||||}||||||||||||||||||||||}}|||||||}}||||||||||||||||||||||||||||||||||||||||}||||||}||}||}|}||||}|||||}||||||||||||}||||||||||||}|||||||||||||||}|}|||||||}||||||||||||||||}||||||||||||||||}|||||...

output:

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

result:

ok 4577 tokens

Test #14:

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

input:

4560 4558
}}}{}{{{{}{}{{}}{{{}{}}}}{{{{}}}{{{{}{{}{}{{{{{{}}}}}{}}{}|{{}{{}}{}{}}{{}{|{{{{}{{{{}{{}|{}|}}}{{{}}}}{}}}}}}}{{}}{{{{}}}{{}}{{}}|{}}{{}{{}}{}{}}}}}}{{}}|}{}}{}}}{{{}|{}{{}}}}}}}{}}}{{{}{{{{{{}{{{}}}|{}}}{{}}}}{{{}}}}}}}{}|}}{}{}{}|{{{{}{{{{}|{{}{}{}{}{}}{}}}{}}}}{{{|}}}}}}}}}{}}}{{{}{{{{...

output:

200 3999489 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4559 tokens

Test #15:

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

input:

4582 4580
{|}}{|{}}{|{}}|{}|{|}{||{{{|{|}}}{}}|{}}{{|{|}}{{||{{|}|{}|||{}||}{}{{{|{|||{}}{||{||}}{|{|{|{{|||}}}||{{{{{|}{}|}{{}{}{{|{}}{}||}}{}{{{}{|}|}}{{{}|}}}}{}}{|{}}}}}{||{{{{|{|}{{}||{||}{{}|{|}}}}|{|||}}||{|{{}|{|}}{}{{{|}|}|}||}|{|}{{|}|{}}{{{{|{|{{|{}}{{|}|{}||{|{||}{}{}}}|||{|{}{{{|||}{{{}...

output:

1782 724 245 89 41 15 6 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 4581 tokens

Subtask #2:

score: 20
Accepted

Test #16:

score: 20
Accepted
time: 278ms
memory: 77900kb

input:

99981 99979
}|}{|}|}||{{{{|}}}{|}|}|}||||}}}|||||}|{{|||{|{}||}}{}}}}||{}{{}{{|{}{|}}}{|}||{|{}}|{{{|}{}{}}|}{}}{}||||}{|{{}{|{}}{}}|}}{|}{{}{{}|{|||{|{{}}{}{|}{||}}||}|}|}|{}{{}|}||}{{|{}{}}}||}}|}}||{||||||}}{}}}|}}|}}}}|}}}}||||{}}{{|{{}|}|{{}{|}||}{|}|}||{}}|}|{{{{{||{}}{}|{|}{{{|}|{|{|}}|{|}{}}...

output:

28892 8382 2558 832 288 88 39 4 4 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 0 0 0 0 0 0 0 ...

result:

ok 99980 tokens

Test #17:

score: 0
Accepted
time: 278ms
memory: 79580kb

input:

99955 99953
{}{||{}{||}||{}{{{{{{}}|||{{{{}}}}{{}|{{{}{|}{}}{|{||{{|{}|}|{||||{|{{{{}{|}{}{}{{}}{}}}{}{}{}{{|{|{{{}|}{{{||{}{}||}{|}{}||}|||{|{}{}}||{}}{{}|}}{{}{{}{|}{}{}}}{||}{|}{|}{||{{{{}{{|}|||{|||{{|}}|{{}{|}{|{{}{}|}{||}}}}|||}||{}{{||||}||}{}|{|{}||{{{}{{{||}}|}{||}}}|}{}{|||}}}|{|{}{|{{{|{|...

output:

28685 8565 2557 826 268 90 33 16 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 99954 tokens

Test #18:

score: 0
Accepted
time: 316ms
memory: 80380kb

input:

99981 99979
||}|}|{}{{}{{{}}|{}}}|{{{}||{{||{{|}{}}}}{{|}{{}{}|}|{}}|}{{{}|}{}{{}}|}|}}|}{{||{{}{{||}|}}|}{|{|{{}{|{}|}|}}}{}|||{}}{|}{{{||||{{{|{{}}{{{{{{|}{}{}}}}||{|}}}||{}{{{{{}||{{|{}}|}{|}}|{}{{}|}||{{{{{|{|||}{|}}{}{{|}}|}{|{{|||||}|}|}}{{|{}|{{{}}|}}}}}|{}}||}{{{{|}{|{{}||}{||}{}}}|}|||{|}{}...

output:

2400167714 146 51 17 2 4 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 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 99980 tokens

Test #19:

score: 0
Accepted
time: 510ms
memory: 83880kb

input:

99967 99965
|{{{}{{}}}{{}}{}}}{{{||{}|}{|{{|}}}{{}{}{{{|}}}{||{|}|||}{{}|{||{|{{{|{}|}}}|{}}}{{}|}|||{}||}|}}{{||{}{{}}{||}||}}|}}{|{{||||}{|}}|}{}{}{|}|{|{{|}|{||{}{}|{{|}{{}||{||{{||}}{}||{{|}||}|||}|{}{}|{|}|{{{{}}|}}{}}}}}|||}}{{|}{|||||}{|{{}|}{}{||}{}{{}{{}}||{|{{|}|{|}|}|}|{}{|{}|{{}{{{}||{{}...

output:

641 159 52 13 5 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 99966 tokens

Test #20:

score: 0
Accepted
time: 232ms
memory: 79304kb

input:

99964 99962
||||||||{|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||...

output:

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

result:

ok 99963 tokens

Test #21:

score: 0
Accepted
time: 342ms
memory: 79340kb

input:

99953 99951
}{{{}}{}{{{}{{{{}}}{{}}{{}}}}}{}}{{}}}}}}{{}}}}}{{{}}{}{}}}{}}}{}}{}}{{}}{}}{}{{}{{}{}}{}}}}}{{{{{{}}}{}}{}}}{{}{}}{}}}}}{{}}}}{}{{}}}}{}}{}}{{{{{{{}{{{}{}}}}{}|}}{}}}{}}}}}}}{{}}{}{}{{{{}}{}{}}{}{{{{{{{}}{}{{}{{{}{{{{{{}{}{}}}{{{{}}{{}{}{}}{}{{}{}{}}{}}{}}{}}}{{}}{}}}}}}{}}}{}{}}{}{{{{{...

output:

157106 355 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 99952 tokens

Test #22:

score: 0
Accepted
time: 242ms
memory: 78672kb

input:

99961 99959
{}{|}{||}{|||}{||||}{|||||}{||||||}{|||||||}{||||||||}{|||||||||}{||||||||||}{|||||||||||}{||||||||||||}{|||||||||||||}{||||||||||||||}{|||||||||||||||}{||||||||||||||||}{|||||||||||||||||}{||||||||||||||||||}{|||||||||||||||||||}{||||||||||||||||||||}{|||||||||||||||||||||}{||||||||||||...

output:

2016 461 122 42 13 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 99960 tokens

Test #23:

score: 0
Accepted
time: 227ms
memory: 80056kb

input:

99964 99962
{}||{}}{{}{{{|}}}{|}|}{||{|}}{|{}||{|||}|}|{}{}}{{|{}}}||{}{}}}||{{|}}{}}{|{|{}{}{{|{|{|{||{}|{}{{{||}|{|}{{}}{||}}|||}|||}}{|}{}{|}}{|{|}{{{|{}}{}{}{}}{}|}{{}{}{}}{{{|}{{{}}}|{|{{{{|}|}{|}{}|{|{{||}|{}}}}{{||}{||}|}|}}{||{{}{{}|}|}{|}|}|}}}|}{}{{{||{|}}|{}||{}}}{}{}}{|}}}}{{}}}|}||||{}}...

output:

529 173 55 9 9 2 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok 99963 tokens

Test #24:

score: 0
Accepted
time: 359ms
memory: 78432kb

input:

99977 99975
}}}}{}{}{{{{{{{{}}{}}{}}}{{{}}}{}}}{}{{{}{{}{}{}{}{}}}}{{{{{}}{}{}}{{{{{}{}{{}}}}}{{}{{}{{}}{}{}{}{}}}{{{{{}}{{}{{{{}}}}}{{{{}}}}}{{}}{}{}{}}{{}}}{}}}}{{{}{}{{{}{}{{{{}}}{{{{}}}{{{{{{}{}{}{{{}{}}{}}}{}}}}}}}{}{{{}}}}{{{}}{{{}{{{{}{}}}{{}}}}{{}}{{{}{}}}}}{{}}}{}{{{{{}{}}}{{{}{{{{{}{}}}{{}...

output:

198696 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 99976 tokens

Test #25:

score: 0
Accepted
time: 360ms
memory: 77004kb

input:

99955 99953
{{{}{}}{{{}{}}{{{{}{}}}{}}{{}}{{}}}{{}}}{}{{}{{}}{}{}}{{{}}{}{}{{{}{{}}}}{}{{}{}}}{}{{}{}{{}}{}}{}{{{{{}{}}}{{{}}{}}}}{{}{}{}{{}{{{{}{}{{}}{{{{{}{}{{{{{{{{}{{{{}}{{{{{{{{}{{{{}}}{{}}{{{}{}}}}{}}}{}}{}{{{{}{}}}{{}}}}}{}{}}}{{}}{}{}}}}}}{}}{}}{}}{{}}}{{{{}}{}}}}}{}{}}{{}}{}{{}{{{{}}{}}}}}}...

output:

299708 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 99954 tokens

Subtask #3:

score: 5
Accepted

Test #26:

score: 5
Accepted
time: 424ms
memory: 70996kb

input:

99990 0
}}}}{{{}{{{{}}}}}{{{{{}}{{}{}}}{}}}{}}}{{{}{{{{}{}}}{{}{{{}{}{}{{{}}{{}}{{{}}{{{{{}{}{}{}}{{{}{}{}{}}{}{}{{}}}{{{}{}{}}{}{}{}}}}}{}{{{}{{{}}{}}}}}{{}}{{{}}}{{}{{}{}{}}{}{}{{}}}}{}{{{}{}{{}{{}{{}}}{}}{{}{}}}}}}}}}}}}{{}}{}{}}}{{{{{}{{{}}{}}{}{{{{}}}{}}}{{}{}{{}{}}{}}}}{}{}{}}{{}}}{}{{}}{{{}}{...

output:

637900 

result:

ok "637900"

Test #27:

score: 0
Accepted
time: 437ms
memory: 70660kb

input:

99976 0
{{{{}}{}{}{{}{}{}}{}{}}}{}}}}}{}{{{{{{}{{}}}}}}}{{}}{{{}}{{}{{}}{{{}{}{}}{}{{{}{}{{{{{}}}{{}}{}}}}{{}}{{}}{{}}{{}{{}{{}{{{}}{}{{}{{{}}{}{}}}}{{{{{}}{{{{}}{{{{}{{}{}{}{}}{}}{{}}}{{}{{}}}}{{{}{{{}}}{}{{}{{{{}{{{}{}}}{}{}}{}{{{{}}{{}}{{{{}{{{}{}}}}}{{}{{}}}{}}{}{{{}}{}{{{{{{}{{}}{}{{{}}{{{}{}}}...

output:

625351 

result:

ok "625351"

Test #28:

score: 0
Accepted
time: 364ms
memory: 69024kb

input:

99994 0
}{}}{}{{{}{{}}}}{{}{{{}{{}}{{}{}}}}}{{}}}{{}}{{{}{}}}}}{}{}{{{}{{}{{{{{{{}{{{{{}{{{{}}}{}}{}{{{{{}{{}{{{}{}}{{{}}{}}{{}}}{{}}{{{{}}}}{}{}}{}{}{{}}{}{}}{{{{{}}}{}{}}}{}{}}{{{{}{}{}}{{}}}{{{{}{}}{{{{}}{{}{}{}{{{}{{}{}{{}{{}{}}}{{{{}}}}{}{}{}}{}{}}{}{}{}{}}{{}}{}{{}}{}}}}}{{}{{}}}{{{}{{{{{{{{{}...

output:

56331611 

result:

ok "56331611"

Test #29:

score: 0
Accepted
time: 645ms
memory: 79500kb

input:

99962 0
{{{{}{{{{{{{}{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{...

output:

2614 

result:

ok "2614"

Test #30:

score: 0
Accepted
time: 316ms
memory: 68944kb

input:

99955 0
}}{}{{{{}{}}}{}}}}{{}}}{{{}{}{}}{}}}{{}{}}}{{{{}}{}}}}{{}{}}{}{}}{{{{}}}}}{}{{}}{}{{}{}{{{}{}}{}{{}{{{{}{}{{{}{}}{}{}}}{}{}{{}}{}{{}{}{{{{}}{}}}}}}{{{{}}{}{}}}}}}{}{{{{}}{{{}{}{{}}}{}}{{}}{{}}}{{{{{}{}{{{{{{{{}{{{}}{{}{{{}}}{}}{}}{{}{}{}}}}{}}}{{}}}{}}{{}{{}}{{{{}{{}{}}}{}}{{}}}}{}}}}}}{}}}{...

output:

7871913 

result:

ok "7871913"

Test #31:

score: 0
Accepted
time: 383ms
memory: 66748kb

input:

99950 0
}}{}{}{}{{}}{}{}}{}{{}{{{}}{}{}}}{{{}}}}}{}}}}}{{}}{{{}{{{}}{}}}{}{{}}}}{{}{}}}{}{}}}{}{{{{}{}{}}}{{}}{{{}{{{{{}{{{{}}}{}{{{{{}}}{}{}}{}{{}}}{}{{{{{}{}{}{}}}{{}}{}{{}}}}}}}}{}}}}{{}{{}{{}}{{}}}{{}{{{}{{}}}}{}}{{{{}{{}{}{{}{{}}{{{}}{}{}}}}{{}}{{}{{{{}{}{{{{{}{}{}{}}}{{{{{{}}{{}}{}}{}{}{}}}}}}...

output:

3425629 

result:

ok "3425629"

Test #32:

score: 0
Accepted
time: 506ms
memory: 79876kb

input:

99961 0
{}{{{{{{}{{{{}{{{{{{{{{{{{{{{{{{}}{{}{}{{{{{{{}{{{{{{{{}}{{{{{{{{{{{{{{{}}{}{{}}{{{{}{{{{{{{}{}{{{}{{{}{{{{{{{}{{{{{{{}{{}}{{{{{{}{{{{{{{{{{{{{{}{{{{{{{{{{}{{{{{{{{{{{}}}}}{{{}{{{{}{{}{{{{{{{}{{{{{{{{{{{{{{{{{{{{{{}{{{{{{{}{{{{{{{{{{{{{{{}}{{{{{}{{{{{}{}{{{}{{{{{{{{}}{{{{{}{{{{{}{}{{{}{{{{{}...

output:

43885 

result:

ok "43885"

Test #33:

score: 0
Accepted
time: 217ms
memory: 75140kb

input:

99975 0
{{{{{}{{{{{{{{}{}{}{{{{{{}{{{}{{{{{{{{{{}{}{{}{{{{{}}{{{}{{{}{}{{}{{{}}{}{{}}{{}{{{{{{{{{}{{}{{}{{{{}{}{}{{}{{}{}{}{{{}}{{{{}{{{}{{}{{{}{{}{{{{{{{{{{{{{{{}{{}{{{{}{}{{{{{{{{{{{{{{{{{{{{}{{{{{{{}{}{{}{{{{}{{{{{{{{{{}{{{{{{{{}}{{}{{{{{}{{{{{{{{{{{{{{{{{{}{{}}{{{{{{{{}}}{{{{{{}{{{}}{{{{}}{{{{{{...

output:

26290 

result:

ok "26290"

Test #34:

score: 0
Accepted
time: 394ms
memory: 71988kb

input:

99982 0
{{{{{{{}}{}{}{{{{}{{{}}}{}}{{{{{}{{}{}}}{{{{}{}{}}}{}{}}}}{}}}{{{{}{}}{}{{{}}{{}{{}{{}}}{{{}}}}{{{}}}}}}}}{}}}}{{}{}}}{{}}{{{}}}{{}}{{{{}{{}}}}{{{}{}{}}{{{{}}{}{}{}{}}}}}{{{{}}{{}}{{{{}{}{{{{}{{}}}{}{}}}}{}{}{}{{}}}}{{{{{{{{}{}{}}{{}}{{}{}}{{}}}}{{}{{{}{}}}{{}{}{}}}{{{}}{{}}}}}}}{{}}}}{{}}{}...

output:

341295 

result:

ok "341295"

Test #35:

score: 0
Accepted
time: 452ms
memory: 79004kb

input:

99989 0
{{}}{{{{}}{}{}{}}}{}{{}}}{}}{{}{}}}{{{}{}{{}{}}{}}{}}{{}}{}}{}{{}{}}}}}}{{}{{}}{}}}}{}{}{}}}}}}}}{{{{{}{{{{}}{}}}{{{}{{}{}{}{}}}{}{{{}}{}{}{{}{{}}{{}{{}}{}}}{{}{{{}}}}{{}{{{}{}{}{{{}{{{{}}{{{{}{{{{}{}}}{{}}{{}{}{{{}}{{{}}{{{{}{}{{}}{}{}{{}{}}{{}{}}{}}}}{}}}}{{}{{{{{}}}{{{{{}{}}}}{{{}{}}}}{{}...

output:

2376357467 

result:

ok "2376357467"

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #36:

score: 15
Accepted
time: 364ms
memory: 71260kb

input:

99962 3
}{{}}}|}{}}||{{||{{}}}}{}|{}|}}{|}}|||{{|{}{{{||{}|}{|||||}|{||{|{{}{}{}||}{}{|{||{|}|}|{{|}}{|}}}{|{{}{|}{{}|}}}|{}}|{|{{||{}{}}}|{{{{||}}|}|||}{}||}}|{}}{{|}}}{|}||{||}}}|{{}}}{|}|{}}|{}||{{{{}}{}|}||{}|||{{{}{||{||{|{}{}}{{||}|}}|}{{}}{|}||{{||}|}||{{}}{}{}}|}}{|}||}}||}{|{{|}|}}||}{|{{{{...

output:

37014 13518 4855 1819 

result:

ok 4 tokens

Test #37:

score: 0
Accepted
time: 321ms
memory: 68720kb

input:

99980 3
}}|}}{|{{|}}||||}{{{}}{|||{|}{{|||{}{||}|||}||}}}{|}{{{}{|}}|{}}}}||}{}}||||{||{}|}{}{|}||}{}|{}}}{}{|||}}}}{}}|}}{{|}{{|}|{}}||}|{|}||{}|{||}}{{|{{|}}{}{||}|{|{|{}}|}|{||{{{}||}|{}{|{{}{{||{{{{|}|}}}|}{{{}||{{||{}{|{{||}{|{|||}}{}}|{{{{||}{||}}|{}|}|{|}|}{{|{{{|{{{||}}{}{{|{{}|||}|{}{|}||{|...

output:

48311 17859 6080 2702 

result:

ok 4 tokens

Test #38:

score: 0
Accepted
time: 322ms
memory: 70596kb

input:

99958 3
{|}}}}{}|{}}{|{||}}}}}|{}||||{|{|}{{{}{}{}|{}{}{||{|{|}|||}}||{{}{}|}|{}|}{{|{}}}|}}{}{{||{|||{{}}}|}|}}|}}}|{{{|{{{{}}}|}}|{{{|}{{{|{{}}||||}||{{}}{{||}}}||{{}|}|{}{||}}{|}{{{{|}||}{||}}}}|{}}|||}||}{}{{}|}||{|{{{{}}{}|{|}{{}}{|}|||}{||||}}}}}}}{|}|}{|{{}{|}{||{}{}||||{{}|{|}}}}|{{{||}|}||{...

output:

39635 14384 5425 2004 

result:

ok 4 tokens

Test #39:

score: 0
Accepted
time: 542ms
memory: 80804kb

input:

99996 3
|}|{{|{|}{{}}|}}}}{}}|}}}}{||{}{}}|}}{|}|{|{}{|{}|}|||}}}}{{{|{{{{|||}{|{}|{{}}{{{{}|{}||}}{{{||{}}|}|{{}{}}|{||{}|}}{}}|}{|||{{{|}|{{|{}|{|}}{|}{}}}}|}{}{{}{||}{{}}}}{}|{||{}}|}}}{{{{||{|}}}}|{{{}|}{|{|}{||{}{}{{}||||{|}|}|}{}}{{{{}}{|||||}{{|}{||}||{}|{|||}|||}}}{}}}|{}{}}|||{|}{}}||{{|{}}...

output:

1130 33893 8 0 

result:

ok 4 tokens

Test #40:

score: 0
Accepted
time: 379ms
memory: 77676kb

input:

99987 3
}}}}{{}}{}{{{{{}}{{{{}}}}}{}}}{}}}{{}}{{{{}}{}{{{{{{}{{}{{{{}}{}}}}}{}{{{{}{}}{{}}}{{}}}}{}}}{{{{}}{}{{{}}}{}{}{{}{{}}}}{}}{}{{{}}{{}{{}}}}}{}}}{{{{{}}{}}}{{{{{}{{}{}{{}{}{}}{}}{{{{}}{}{{}{{{}}{{}}}}}}{}}}{}}}}}{}}{}}}{}}}}}{}{}{{{}}}{}{}{{}{{{{}}{{{{{}}{{}}{{{}{}}}}}}{{}}{}}}{{}}}}{}}}{{}{{...

output:

166216 260 2 1 

result:

ok 4 tokens

Test #41:

score: 0
Accepted
time: 196ms
memory: 73948kb

input:

99997 3
}}}}{{{{{{}{}{{{{}}}}}{}{{{}}}{}}{}}{{{}}{{}}}}}{{}{}{}}}{{{{}}}}}}}}}}{}}{{{}{{}}}{{}{{{{}}{}}{{{{}{{{}{}{{}}}}{}{}{{{{}}{{{{}}{}{{}{}}}}{}}}}}{}{}{{{}{}{}}}{{{}{{}{}{}{{}{}}}{{{{{{{}{{{}}{{{{}{}}}}{{{{{{{{}{{{{{{{{{}{{{}{}{}}{{}}}{{}}}}{}}}{{}}}}}}}}{{}{}{{}{{}{}}}{}{}{{}{}}{}{}{}}{}}{{{{{...

output:

150236 60 1 0 

result:

ok 4 tokens

Test #42:

score: 0
Accepted
time: 393ms
memory: 79988kb

input:

99979 3
{{{}}}|{}{|||}|||}}}}}}|}}||{|}}}||||{}}{|{|{{|{}}}{}}}{}|}{{}{||||{|}|}|{{|||{||||{{|{{}||{}|{{|{}}}|}|}}}{}}|}|{|{}}{|{}}}{|{|{}}|}{{}}}|}{}{}{|{}|||{{{}|}{|{{{}}{||}{{|{||{}||||}|{}{|||{|}|}}|}||}{{{|{}{}{{|}{{}}}|}|||}{}{}}{}{}|}{{}{||{{}{{{{{{{{{}|}}{}}|{||}{}|}|}{}}{}}}{|{}||||}|||{}}}...

output:

33207 547667770 0 0 

result:

ok 4 tokens

Test #43:

score: 0
Accepted
time: 117ms
memory: 69900kb

input:

99975 3
{{}{{}}}}{{}{{{}|{}}}{}{}{{}{{{{}}{}{{}{{|}}{}{{{{{}{}}{}{{{{{}}}}}{}}}{}}}}{}{{{}{}}}}{}{}{{}{{}{{}}{}{}}}{{{{}}{{}{{{}{{}}{}{}{}{{{{{}{{}{}{}}{{}}}{}{}}}}}{{{{{}{}{{}}{}}{}}}}}}}}{}}{{{}{{{{}}{{}}{}{}{}{}}}{}}}}}{}}{}{{{}}}}{}}{}{}{|}}{{{{}{{}{{{}{}{{{}}}}{{{}}{}}{}}{}{{}}{}}}{}}{{}{{{{{}{...

output:

323 1 0 2448864192 

result:

ok 4 tokens

Test #44:

score: 0
Accepted
time: 351ms
memory: 72520kb

input:

99979 3
||}}|}{}{{{}|{}{{{}}|||}{{}{||||||{{{|{{}}|{}}|}{}}}|}{{{{}}|{{}||{}|}{}}}|{}{}||}{}{{{{{{{{{{}|||{}|||}||{}}|}}|{|||{}}|{{}|}|}|{|{|{||{{||{|||}}}|{||}}{{}{|{{|{{}|}|}|{{}}}{{}|{}}}{{{||||||{|{{|{{{{}{{{|{}|{{{{}{|{|}}}}{}|}{|}}}|{{}}|{}{||||||{|{||}}|}}{{{{|}{}}|}|}{|{}}|}{}}}|{{{{|{{{}{}}...

output:

35099 13404 5066 1642 

result:

ok 4 tokens

Test #45:

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

input:

99981 3
{{}{}{{{}{{}{{}}}{}{{}{{{{{}}{{{}}}}{}{{{{}}|}{{{}}}{}}{{{{{{{{{{{{{}}}}{{}}{}{{}}}{{}{}}}{{}{}{}{{|}}{{{{}{{{}{{}}}{{}{}}{{}{}{}{{{{{{{{}{}}}}}}{{{}}}{}{}{{{}{{}{}}{}{}{{{{}{}{{{}{{{}{}{{}{{{{{}{}}{{{{}}{}{{{}}}}}}{}}{{{}}{{{}{{}}{}{}{}}}}{{}{}{}{}}}}}{{}}{}}}{{{{{}}{{{}{{}}{}{{}}}}{}|{{}{}...

output:

266389 496 14 0 

result:

ok 4 tokens

Subtask #5:

score: 25
Accepted

Dependency #1:

100%
Accepted

Test #46:

score: 25
Accepted
time: 167ms
memory: 65548kb

input:

49951 49949
}|}|}|{{{|{|}{|||||}|{}{|{{{{}||}}{|{|}|}{{{|{}}|{|{||{}{{{}{}||||}||}{{{{|{||{|||}{{|}|{}{{{}|{}}||}{|}}}||}{}|||{{{{{}}{||}||}}||{}}{|}{}}{|{{|}|{}|{}|}}|}|{|{|}{{{}}{|{}|{}}||}}}{{{}}|{{||||||||}{|}}{}}}{{}}}{}{||{}}}}}}}{|||{|{{}|{{{{}|}||||{}}|{|||{||{|{|{|||}{}}|}{{{}|{{{|}|}{{|{}}...

output:

18354 6771 2539 1034 403 141 58 22 6 4 2 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 0 0 0 0...

result:

ok 49950 tokens

Test #47:

score: 0
Accepted
time: 147ms
memory: 63664kb

input:

49986 49984
}}|}|}}{}}|{}{{{|{}||{|{||}}||}}||}}|{||||{|{}}{|{}|}{{||{|}}{{{||{|}{}}|}{{}{{||{}}{}|{{|||{||{}}}|{}}||}|{||}}{|{|{}|}}{}}}{|{{|}{|{}|{}{{|}}{{}}}{|{{{}|{|}||{|}}{}{}}}|}{}{}{}|}|||{|}|{{}|}}{||}|}{|}}|||{{}{|{}}|}}}|||}}}|{}|{}}{}{{|||||}}{|{|}||}}{|{{{{}}}||{|{|{{{}{{{|{{}{}{|}{||}{}...

output:

23672 8952 3214 1437 522 279 117 56 27 15 7 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 49985 tokens

Test #48:

score: 0
Accepted
time: 164ms
memory: 67840kb

input:

49995 49993
{|||||||||}||||||||||||||}|||||||||||||||||||||||||||}}|||||||||||||||||}|||||||{|||||||||||||||{|||||}|{||||||{|||||||||||||||||||||||}|||||||||||||{|||||||{||||||||||||||||||||||{||||}||||||||||{||||||||||||||||||||||{||||||}||||||{||||}}|||||||||{|||||||||||||{||||||||||||||||||||||||...

output:

0 37 62 72 73 63 77 69 62 53 58 59 79 74 60 58 71 66 86 72 76 61 74 87 70 85 63 72 67 67 68 80 62 69 61 92 74 57 72 67 74 56 81 80 69 61 74 80 66 81 64 68 70 85 55 64 67 58 63 67 78 64 62 64 68 67 64 80 60 74 70 71 85 78 79 65 76 64 74 64 77 52 59 71 78 64 64 72 69 100 73 57 88 70 79 60 73 70 75 67 ...

result:

ok 49994 tokens

Test #49:

score: 0
Accepted
time: 191ms
memory: 67168kb

input:

49995 49993
{{{{}}{}{}}}{}{{{{{}{}{}}}{{}}{{{}}{{}{{}{{{}}}}}}{}{{}{{}{{}{{}}}}{}}}{}{}{{{}{}{{}{}{{{{{{{}}}{{|}}}}}}{}}}{}{}{}{}}}{}}}}{|}}}}{{{{{{{}{}{{{}{}{}|{{{{}{{}}}}{}}}{}}}}}{}{{{{}{}{}{}}{{{{}{{{{}}{{{{}{}{{{}{}}}{{}{{{}{}{}}{}}}}}}}{}{}}}}{}}{}}}{}{}|}{}{{}}{}{{{{{{|}}}{}}}{{}}}}{}}{}|}}{{...

output:

543113744 31 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 49994 tokens

Test #50:

score: 0
Accepted
time: 97ms
memory: 68004kb

input:

49957 49955
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}|||||||||||||||||{||||||||||||||||||||||||||||||||{|||||||||||{|...

output:

0 2653 0 0 2 1 1 0 0 0 0 0 1 0 1 0 1 0 53 1 0 0 1 2 0 2 0 0 0 1 0 1 0 2 1 0 0 0 0 0 1 2 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 2 0 1 1 2 0 1 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 1 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 49956 tokens

Test #51:

score: 0
Accepted
time: 190ms
memory: 68940kb

input:

49982 49980
|||||||}||||{|||||||||||||||||||{||||||||{||{|||||{|||||||||}|}|||||||||||}|{||{}||||{||{||||||}||||{|||||||||{|||}||||{|}|||}||||{{|||||||{||||||||||}|||}|||||||||||}||||}|||||||||||||||||||||||{||||||||||||||||||||{||||||||||}||||||||}{||||||||||}}|||||{|||{||||||||{}{}||||||||||||||||...

output:

238 252 483 467 502 499 498 458 462 446 471 451 481 470 478 439 453 475 461 489 480 510 471 454 448 489 451 479 500 415 464 451 455 482 488 509 511 457 436 472 479 486 500 467 464 460 456 478 490 453 465 501 488 472 478 477 496 487 485 448 452 472 472 471 477 490 451 482 495 458 493 491 454 505 451 ...

result:

ok 49981 tokens

Test #52:

score: 0
Accepted
time: 203ms
memory: 65420kb

input:

49958 49956
|}|||{}}{{{{|{|}{|{|}{}}}{|{{}|{{}}{}|{|||}{}}||{|||||||||||}||||{||}{{||{||}|{}}||{||||}||}}|{||{{|{}||||||||}|}}}||}|{||||}}}{}|}|{||||{|{}||||}|{{|{}}||{|||{||}{|||{}}|{}}|||{}|||}}}}}}|{}{|{}}||{}}}|||{|}|||||{|||||}}||}|||||}{|}|{||}}|}||||||}{||{|||}|}}|}{|{}{|{}|{|{}|{||}|}|}|||{}...

output:

6257 4550 7650 9341 9845 9935 10079 9824 10096 10029 10144 10161 10217 10093 10023 10000 10166 10168 10199 10109 9933 10104 10180 10039 10208 10110 10086 9817 10137 10028 10052 9851 9955 10240 10022 9831 9938 9856 9943 9988 10167 9993 9996 9951 9934 9953 9945 9918 10120 10103 10154 9797 9975 10097 1...

result:

ok 49957 tokens

Test #53:

score: 0
Accepted
time: 141ms
memory: 66456kb

input:

50000 49998
|{{{{|{|||{|{{{||||}|}}||{||{|}||}|}|||{}{}|||}|}}||||{}||}}}}}{|||}}|{|{}{{|}||||}}||{|||{}||||}|||||{{{}|}{||}{{||}{||}|||{}|}||{|||||{|||{|||}{}||{||{}|{|{{||}|||{||||{}||}}|{|}|{{|{{||}{}}}|}||{|{}|}}}{|}{|||||||}||||{|}|{{{|||{{|{{{}{{}||||{||||{{|}{|}}{|}|{{|{|{}|||||}}|{{{{}|{{|||...

output:

0 1221 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150...

result:

ok 49999 tokens

Test #54:

score: 0
Accepted
time: 151ms
memory: 64240kb

input:

50000 49998
|}|{}}|{{|{{{{}{}{}}}{}|{{{|{{{|}{{{{{|}{}}{{}{}}|{{{|{|{|{{|{|{{|}|}{{}}}||||{|{}|{}}}{{{}{||{}||{{}}{}}|}||{}}{}{{}||}|}||}{|{}}||}||{}{|{|{|{}}}|{{}}{{{{{{}|}{|}}}{||{{{|}}{{{|{{|{|}|{{||{|}}|}}}{{{{{}}{}{||{}|{{|}{}|||{}}}{}}{{}}|{{{||{{{|{|{{|{}}|{{|}{{{{{}{{||{}{|}{|}{}{{}||{|{|{}|...

output:

7129940 2252 1274 3182 212 106 57 46 50 57 54 52 60 58 63 75 68 71 85 76 90 90 88 85 95 105 108 100 108 124 132 204 143 141 147 138 126 136 117 124 132 134 145 149 148 143 161 170 124 165 167 171 186 170 176 204 186 187 191 176 189 195 173 182 201 203 201 201 221 218 204 214 178 217 179 158 204 172 ...

result:

ok 49999 tokens

Test #55:

score: 0
Accepted
time: 136ms
memory: 64584kb

input:

50000 49998
|||{}||}}}{}||{}}{{}|}||}|}{|}{}{|{}||{|{}|||{}{|||}|{|{{{}|{}{}}|{|||}|{|}{{{}|}||}||}|}}|}}}||}{{{}}}}|}}}{|}}{}|{}{{{|}}{|}||{{{{{{}|}}|{|}|{{}|}}{{{}}{|{||}{}}{}}}|{{{|}|}}{{{}}}{{{}}||{{}|}|{|}{{|}}{}}}}}}}}}{|{{|}{|}}|||{|{}|}{|{}}|{|{{}}|{}{}}|}{{}}{}}|{{}||}|}}}}|}}{{{|{|{|{}|}}}...

output:

1712460 4001791 1070 625 546 473 481 474 473 543 485 512 552 578 575 554 603 614 579 571 590 588 560 604 575 634 606 657 572 623 666 642 678 620 685 684 714 687 665 697 714 731 665 649 636 711 695 688 694 658 688 702 711 680 718 678 714 744 682 752 762 737 738 760 765 754 801 769 765 813 798 835 830...

result:

ok 49999 tokens

Subtask #6:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #56:

score: 30
Accepted
time: 322ms
memory: 69792kb

input:

100000 99998
}}|}}||}|{}}||}{}{{{{||}|}{{}}}|}{{}{}{}{{{}|{}{||{|{{{||}}|}}|{{}{}{{|}}{}{|{{{{{{{{}{||}|||{{|{{{}|{|}}|{}}|{}}}}{}|||}||}|}|{{{{{{}|{{{|{}}}}}|}|}{|{}}|{||{}}}|}{{{}}{|{{}}}|||{}}{}||}{{|}}{{}|}}{|}}{{{{}||||||{|}}|}{{}}}|}{|{|||{}}{||}|{|}{|{||}{}}|{{{}|}|||}{|||}|{|{}{|{{{}{}{}}|{{...

output:

8842400 4004043 2344 3807 759 579 538 520 524 600 539 564 612 636 638 629 671 685 665 647 680 678 648 689 670 739 714 757 680 747 798 846 821 761 832 822 840 824 782 821 846 865 810 798 784 854 856 858 818 823 855 873 897 850 894 882 901 931 873 928 951 932 911 942 966 957 1002 970 987 1031 1002 104...

result:

ok 99999 tokens

Test #57:

score: 0
Accepted
time: 428ms
memory: 77052kb

input:

99976 99974
|}||||||||{|}|||||||||||||||{||}||}||||||}||||{||||||||||||}||||||||||||{||||||||||||||||}||||||||||}|}||||{|||||}|||||||||||||||||}||||||||||||||}|}|||}|||||||||||||||||||||||||||||||||||||||||||||||{||||||||||||||||||||||||{|{||||||||||}|||||||{|}||||||{|||||||||||||||||||{|||||||}}|||...

output:

245 254 521 525 556 522 511 539 564 523 531 537 534 532 554 497 488 569 527 522 500 530 520 560 539 551 537 536 466 580 517 530 539 579 519 544 518 560 532 548 545 520 555 492 550 551 565 503 570 528 497 546 503 568 548 511 555 530 526 521 524 502 524 525 526 562 540 516 544 524 540 508 515 521 525 ...

result:

ok 99975 tokens

Test #58:

score: 0
Accepted
time: 404ms
memory: 78400kb

input:

99958 99956
|||||||}||||||||{{|||||{{{|||||}|||{|||||||{|||{|||}||}|||||||{|||||||||{|||||||||{|||||||||||||||||}|||}}||{||||||||||||{|{||||||||{||{|||||}||||||{|||||{||}|}|||||||||||||||||}||{||||||||}||||||||{||||||||||||{||{|{|||||{|}||||||}|||||||||||||{|||||{|||||||||||||}|}}|||||}|||||||}|||||...

output:

0 164 348 346 309 329 314 353 332 309 335 338 308 345 347 314 350 347 309 330 341 366 298 348 343 306 348 318 331 353 324 353 345 350 316 336 370 305 338 328 325 349 296 338 339 324 341 326 325 318 306 329 329 339 292 358 296 347 334 381 341 342 294 307 337 333 346 324 320 331 358 356 334 316 316 32...

result:

ok 99957 tokens

Test #59:

score: 0
Accepted
time: 429ms
memory: 70352kb

input:

99985 99983
|}||||{{{}|||}}||{}}{}}}|}{{}{}}}|{|{|}{|||}{{||{|||}{|}{{{||||}}{}}||}||{|{{}{{{{{}{||}|}|}||{|}}}}}|}|{{{|}|}}}{|}||||||{{}}}|{{}}{}|{|}|{||||||||{{{{}{|}}|{}}{}{}||{{|}||{}|}{||}||}}|{||||{|}||||}}|}{|}{}|{|{{{|||{|{{{|}|}|{{||{{}||}}{|}|||{|}|||{{{|}}{}}|}}}||{}{|{{}}|}}||}{{||{|}{||...

output:

15369 11044 17160 21266 22826 23346 23597 23622 23327 23138 23469 23516 23402 23380 23320 23205 23311 23366 23374 23249 23236 23214 23149 23228 23357 23514 23475 23152 23401 23356 23239 23584 23234 23014 23386 23215 23381 23177 23186 23378 23098 23345 23326 23043 23215 23131 23383 22950 23504 23605 ...

result:

ok 99984 tokens

Test #60:

score: 0
Accepted
time: 370ms
memory: 72624kb

input:

99957 99955
}}|||}{}{|{|{{{{|}{}}|||{|}{|||}}{}{{{|{|}}|{{{||}}|{}{}||{|{||}}{}}{}}}{|}}|}}{}}{|||{}{|}{{|{}|{}}{{}|{{{}|}}|{}}|{|}}}|||{}{|}}{{|{{|{|}}}}{|}|{|}|||||{{{|{}|{}}}}{{}||{|||}}}{{{|}{}}|||{}|{{}{|}{}|||||{}{|}}{}{|{||}|{}|}}}{{|}{|{}{}|{{|{{{||{}||}}}{}{|}{}}|}|{}{}|}}|}|||}{{}{{||{}}|}...

output:

37174 13247 4981 1918 754 216 111 31 20 6 4 1 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 0 ...

result:

ok 99956 tokens

Test #61:

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

input:

99995 99993
}{|{||}}{}{{{{||{{|{}{|{}|{}}{}}|{|{}}}{{{}{|{|}{|||}}}|}}{{|||{{}{}|}}{}}{}||}|{}}}}{{{}|{|}||{{}}}}|}}{{{{{|||{{{}}{}}}{}}}|||}||||{{{{}||{}{|}}|{|{{|}||}}|{|}|}||{}}|||{{{{||{}{}}}}{{|{|}}|}}}|}{{}}|}|}|{||||{{{{{||||{}}{{|{}|}{}|||{}|}|}|}}{|{{{||}}{||}}||}{{}|{}||{||{{||}}|{}{}{|{|}...

output:

46972 17215 6328 2761 1142 451 231 92 33 15 8 5 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 99994 tokens

Test #62:

score: 0
Accepted
time: 135ms
memory: 71016kb

input:

99999 99997
{}}}}}{}{}}}}}}}}|{}{}}}{{{|{{}}}}{{}{{}}}{}}{{{{}{{{{}{}{|}{{{}}{}}{}{}{}}}{{{{}{}{{}}{}}}}}{{}}}{{{{}}{{{{}{}}{{}{{}}}}}{}}}{}{}{{{{|{}}}{}}}}}{}{}{{{{}{{}}}}{}{}{{}}}}}{}{}}}{{{}{{{{{}}}{}}}{}}{}{}}{}{{{}}{}{}}}|{{}}}{}}}{{}}}{}{}}}}}{{}{}}}{{}}}}{}{{}{}{}{{}}}{}{}}{{{{{{}}}}{{}{{}{}{...

output:

347 48495 511 48980 97517 97498 49011 480 48988 493 97519 97475 97484 49008 48988 97495 97530 97484 49008 97488 49000 49001 483 48983 48976 482 48986 97495 48992 491 508 49024 48988 483 48987 48940 49005 97486 97478 97485 500 97474 48999 97483 501 48977 48974 458 49021 484 97506 97481 49002 48994 48...

result:

ok 99998 tokens

Test #63:

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

input:

99958 99956
{{}{|}|||}||}}{}{{{|{{|}|||||}{}{}{|}}}|}|}{}|}|{}|}{}{}}{||{|{}|}}|{}{}|{{}}|||{{|{|}|}|}|{|}|{}||{|||}}||{}}{|{|{{{||}|{|{}}{||}{{{{{{|||}{|||{{|{{}}}{{}{{}}|}}||{}|}}{}{}}|{}}{|{{{}}{}}||}{|{}}{|}|{}{|}||}}{}}||}}}|}}|}{}{}}}||}{}}{|||{}}|||{{{{{|{|||{}{}{{{{}{|{|}{{|}}}{{}|{|}{{}|}{{...

output:

35896 13111 5293 1827 571 211 76 26 4 1 0 2 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 0 0 ...

result:

ok 99957 tokens

Test #64:

score: 0
Accepted
time: 333ms
memory: 72488kb

input:

100000 99998
{||}}||{|||||}|{{{{||||||{{||{|||||{{|||{|}||||||{{{||{||}|}{{||||}}|}{}}|{|{|{|||{}||}{||}|||||{||||}{|{}{}}{||}|||{||{}||{||||||{||{}{||}|||}}|}{{|{{{{||}|}||{||}{}||}|}|}|}||}{|}}|||||||||{|{{{||{}|{{|{||{|}{}{{||}{||{}{|{|{||}}|}|{}{{{}|{|{||}|{|||||||}|||}{|}|{|||||{||{|||{{}|}}}||...

output:

0 1296 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 1...

result:

ok 99999 tokens

Test #65:

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

input:

100000 99998
||||{|||||{||||{||||||{|{|||||||{|{|{}}|||{||||}|||||||}|}||||{|{|}{||{}|||}|{|||{|||||||||}}||||||||}|||||}||||{||||}||||||||||{||}||}||}||||}||||}|||||}|||}|||}|||}|}}|{{|{|}|||||{|||||||}|{|||{}||}|||||||||}|}}{|{||{|||{|||||{{|||||}|||{||{|||}|{|{|||{||||}{|||||{||||||}{|||||||{||}{...

output:

3 9 14 18 23 30 34 42 51 61 72 79 87 94 100 105 109 112 114 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 ...

result:

ok 99999 tokens

Test #66:

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

input:

100000 99998
|}}}|{||||}||}||||{|}}|{}|||||||}|{||||}||||}|}}|||||}|||||{||}|||{|{||}|||{||||}|}|{||||}}||||||}{||}|}||}{|||}||{}||}|||{|}{|}{|}|{|||}|}}|}||||||||||||{}||}|}|{}}||||||||||{|{}|||}|||{|{}{||{||{|||}{||||{||||||||||||||||||||||||{}|}|{|}|}{}{|||{||||||{|{||}|||||{{||||||||{|}||||}||{|...

output:

4 8 12 16 21 28 33 41 50 60 71 83 96 110 125 141 158 176 195 215 236 257 280 304 329 355 377 400 422 443 463 482 500 517 533 548 562 575 587 598 608 617 625 632 638 643 647 650 652 653 653 654 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653 653...

result:

ok 99999 tokens

Test #67:

score: 0
Accepted
time: 310ms
memory: 77032kb

input:

100000 99998
{|||||{}||||||||{|}}}||||||}|||{|||}||||{|||{}||||||{|||{||}}|{||{||||}||||}|||}|}||}||||}||{{||{|||{}}{{}|}{|{||}||||||||{|}|}|||||}|||||{|||{||{{||}}||||{|}}|||{|}|{|||||}}|}}|{{}{|}|||{|{|{||}}|}{||{}||||||||{|||}||}{{}||}}|{||}|}||||||{|}||}|||}{|||||{{||||||||||{{|||||||||}|||}|}{|...

output:

3 7 10 14 19 25 32 40 49 59 70 82 95 109 124 140 157 175 194 214 235 257 280 304 329 355 382 410 439 469 500 532 565 599 635 671 708 746 785 825 866 908 951 995 1040 1086 1133 1181 1230 1280 1331 1378 1426 1473 1519 1564 1608 1651 1693 1734 1774 1813 1851 1888 1924 1959 1993 2026 2058 2089 2119 2148...

result:

ok 99999 tokens

Test #68:

score: 0
Accepted
time: 322ms
memory: 76300kb

input:

100000 99998
|||||||||||{}|||}|||||||{||||||{}||||||{|{{|{||||||||||||||||||||{||||}|||{||||||}{{{||||||{||||||||{|||||}}||||{||||{|||||||||}||||}||||||}}|||||}|{|||||||||||||{|}|||||||||{|||||||}|||{{}|{||||||||||||}||}||||||}||||}||{|{||||||}||||||||{||}|}|}|{||{|{|||||||||||}|||||||||||||{|||}|||...

output:

18 22 39 44 49 54 60 68 78 86 98 111 125 138 154 169 186 203 221 239 259 281 304 328 354 379 407 434 463 493 523 554 588 621 657 693 730 768 806 846 888 929 973 1014 1059 1105 1152 1202 1249 1298 1349 1400 1455 1507 1560 1616 1672 1730 1788 1849 1910 1972 2035 2099 2164 2229 2296 2363 2432 2502 2574...

result:

ok 99999 tokens

Test #69:

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

input:

100000 99998
||}|||||||||||||||||||||||{||}||||||||{||||||}|||||||||||||{|}|||||||||{|||||||||||||||||||||||||{|}|||||||||||||||}{|||||{||||||||||||||||||||||||{||||}||||||||||||||||||||||{|||||}|||||}||||||||||||||||{||||}||||||||||||||||||||{|}||||||||||||||||{|||||||||||{{|}||||||||||||||||||||}|...

output:

5 15 23 28 32 37 44 50 59 68 78 90 103 115 131 148 166 182 197 215 231 247 264 283 300 317 335 353 371 388 403 419 434 451 470 486 503 520 538 556 571 591 608 621 638 655 672 690 707 724 742 759 776 794 810 826 842 859 875 894 910 926 943 962 978 995 1011 1028 1046 1061 1079 1096 1114 1130 1147 1165...

result:

ok 99999 tokens

Test #70:

score: 0
Accepted
time: 388ms
memory: 69860kb

input:

99950 99948
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{...

output:

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

result:

ok 99949 tokens