답안 #1099843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099843 2024-10-12T05:35:10 Z model_code 상형문자열 (IOI24_hieroglyphs) C++17
100 / 100
146 ms 29452 KB
// correct/yiping-full.cpp

#include<bits/stdc++.h>
#include"hieroglyphs.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf = 0x3f3f3f3f;

struct Data
{
	int d;
	vector<int> a, cnt, rnk;
	vector< vector<int> > pos;
	
	Data(vector<int> _a, int _d)
	{
		a = _a; d = _d;
		cnt.resize(d); pos.resize(d); rnk.resize(a.size());
		for(int i=0; i<(int)a.size(); ++i)
		{
			int x = a[i];
			rnk[i] = cnt[x]; ++cnt[x];
			pos[x].emplace_back(i);
		}
	}
	bool check(int x,int cx,int y,int cy) const
	{
		if(cx > (int)pos[x].size() || cy > (int)pos[y].size())
			return 0;
		if(cx == 0 || cy == 0) return 1;
		return pos[x][cx - 1] < pos[y][(int)pos[y].size() - cy];
	}
};

struct RMQ
{
	vector<pii> sta;
	void push(int i,int k)
	{
		while(sta.size() && sta.back().second >= k)
			sta.pop_back();
		sta.emplace_back(i,k);
	}
	pii query(int l) const
	{
		auto it = upper_bound(sta.begin(), sta.end(), pii{l, -inf});
		return it == sta.end()? pii{inf, inf}: *it;
	}
};

vector<int> get_cand(const Data &aa, const Data &bb)
{
	int d = aa.d;
	vector<int> type(d), need(d);
	for(int i=0; i<d; ++i)
	{
		type[i] = aa.cnt[i] <= bb.cnt[i]? 0: 1;
		need[i] = min(aa.cnt[i], bb.cnt[i]);
	}
	
	vector<pii> veca, vecb;
	for(int i=0; i<(int)aa.a.size(); ++i)
		if(type[aa.a[i]] == 0)
			veca.emplace_back(aa.a[i], aa.rnk[i]);
	for(int i=0; i<(int)bb.a.size(); ++i)
		if(type[bb.a[i]] == 1)
			vecb.emplace_back(bb.a[i], bb.rnk[i]);
	
	auto check = [&] (pii x,pii y)
	{
		return aa.check(x.first, x.second + 1, y.first, need[y.first] - y.second)
		    && bb.check(x.first, x.second + 1, y.first, need[y.first] - y.second);
	};
	
	vector<int> c;
	int i = 0, j = 0;
	while(i<(int)veca.size() && j<(int)vecb.size())
	{
		bool tx = check(veca[i], vecb[j]);
		bool ty = check(vecb[j], veca[i]);
		
		if(tx == ty) return {-1};
		
		if(tx) c.emplace_back(veca[i].first), ++i;
		else c.emplace_back(vecb[j].first), ++j;
	}
	
	while(i<(int)veca.size()) c.emplace_back(veca[i].first), ++i;
	while(j<(int)vecb.size()) c.emplace_back(vecb[j].first), ++j;
	
	return c;
}

vector<int> get_idx(vector<int> a, vector<int> b, int d)
{
	vector<int> pre(b.size()), bak(d, -1);
	for(int i=0; i<(int)b.size(); ++i)
	{
		pre[i] = bak[b[i]];
		bak[b[i]] = i;
	}
	
	vector< vector<int> > pos(d);
	for(int i=0; i<(int)a.size(); ++i)
		pos[a[i]].emplace_back(i);
	
	auto get_nxt = [&] (int i,int x)
	{
		auto it = lower_bound(pos[x].begin(), pos[x].end(), i);
		if(it == pos[x].end()) return (int)a.size();
		else return *it;
	};
	
	vector<int> res(b.size());
	RMQ rmq;
	
	for(int i=0; i<(int)b.size(); ++i)
	{
		int j = pre[i] < 0? -1: rmq.query(pre[i]).second;
		res[i] = get_nxt(j + 1, b[i]);
		rmq.push(i, res[i]);
	}
	
	return res;
}

vector<int> get_reversed(vector<int> a)
{
	reverse(a.begin(), a.end());
	return a;
}

bool is_invalid(const vector<int> &c)
{
	return c.size() == 1 && c[0] == -1;
}

bool is_subseq(const vector<int> &a, const vector<int> &c)
{
	int j = 0;
	for(int i=0; i<(int)a.size() && j<(int)c.size(); ++i)
		if(a[i] == c[j]) ++j;
	return j >= (int)c.size();
}

bool has_Abad(vector<int> a, vector<int> b, vector<int> c, int d, vector<int> type)
{
	vector<int> vb = get_idx(a, b, d);
	
//	printf("vb: ");
//	for(auto t: vb)
//		printf("%d ",t);
//	printf("\n");
	
	vector<int> pos_Aweak, pos_Bweak, vec_Aweak, id(c.size(), -1);
	for(int i=0; i<(int)c.size(); ++i)
	{
		if(type[c[i]] == 0)
		{
			id[i] = (int)pos_Aweak.size();
			pos_Aweak.emplace_back(i);
			vec_Aweak.emplace_back(c[i]);
		}
		else
		{
			pos_Bweak.emplace_back(i);
		}
	}
	
	vector<int> vc = get_idx(get_reversed(b), get_reversed(vec_Aweak), d);
	reverse(vc.begin(), vc.end());
	for(auto &t: vc)
		++t;
	
//	printf("vec_Aweak: ");
//	for(auto t: vec_Aweak)
//		printf("%d ",t);
//	printf("\n");
//	
//	printf("vc: ");
//	for(auto t: vc)
//		printf("%d ",t);
//	printf("\n");
	
	vector<int> cnt_Aweak(a.size()), cnt_Bweak(b.size());
	for(int i=0; i<(int)a.size(); ++i)
	{
		if(i) cnt_Aweak[i] = cnt_Aweak[i-1];
		if(type[a[i]] == 0) ++cnt_Aweak[i];
	}
	for(int i=0; i<(int)b.size(); ++i)
	{
		if(i) cnt_Bweak[i] = cnt_Bweak[i-1];
		if(type[b[i]] == 1) ++cnt_Bweak[i];
	}
	
	RMQ rmq;
	int cur = -1;
	for(int i=0; i<(int)b.size(); ++i) if(type[b[i]] == 1)
	{
		int j = vb[i], k = pos_Bweak[cnt_Bweak[i] - 1];
		if(j >= (int)a.size()) continue;
		
		while(cur < k)
		{
			++cur;
			if(id[cur] != -1)
				rmq.push(id[cur], vc[id[cur]]);
		}
		
		int mn = rmq.query(cnt_Aweak[j]).second;
		if(mn <= (int)b.size() - i)
			return 1;
	}
	return 0;
}

vector<int> ucs(vector<int> a, vector<int> b)
{
	vector<int> dsc;
	dsc.insert(dsc.end(), a.begin(), a.end());
	dsc.insert(dsc.end(), b.begin(), b.end());
	sort(dsc.begin(), dsc.end());
	dsc.erase(unique(dsc.begin(), dsc.end()), dsc.end());
	
	int d = (int)dsc.size();
	for(auto &t: a)
		t = lower_bound(dsc.begin(), dsc.end(), t) - dsc.begin();
	for(auto &t: b)
		t = lower_bound(dsc.begin(), dsc.end(), t) - dsc.begin();
	
//	printf("a: ");
//	for(auto t: a)
//		printf("%d ",t);
//	printf("\n");
//	
//	printf("b: ");
//	for(auto t: b)
//		printf("%d ",t);
//	printf("\n");
	
	Data aa(a, d), bb(b, d);
	
	auto c = get_cand(aa, bb);
	if(is_invalid(c)) return c;
	
	if(!is_subseq(a, c) || !is_subseq(b, c))
		return {-1};
	
	vector<int> type(d);
	for(int i=0; i<d; ++i)
		type[i] = aa.cnt[i] <= bb.cnt[i]? 0: 1;
	
//	printf("c: ");
//	for(auto t: c)
//		printf("%d ",dsc[t]);
//	printf("\n");
	
	if(has_Abad(a, b, c, d, type))
		return {-1};
	
	for(int i=0; i<d; ++i)
		type[i] ^= 1;
	if(has_Abad(b, a, c, d, type))
		return {-1};
	
	for(auto &t: c)
		t = dsc[t];
	
	return c;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 129 ms 29452 KB Output is correct
6 Correct 113 ms 18380 KB Output is correct
7 Correct 82 ms 18488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 129 ms 29452 KB Output is correct
6 Correct 113 ms 18380 KB Output is correct
7 Correct 82 ms 18488 KB Output is correct
8 Correct 117 ms 18236 KB Output is correct
9 Correct 120 ms 18268 KB Output is correct
10 Correct 103 ms 18436 KB Output is correct
11 Correct 146 ms 18444 KB Output is correct
12 Correct 112 ms 18280 KB Output is correct
13 Correct 93 ms 18124 KB Output is correct
14 Correct 92 ms 18044 KB Output is correct
15 Correct 115 ms 18284 KB Output is correct
16 Correct 100 ms 18072 KB Output is correct
17 Correct 94 ms 18288 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 2 ms 1016 KB Output is correct
22 Correct 59 ms 14312 KB Output is correct
23 Correct 111 ms 23412 KB Output is correct
24 Correct 108 ms 23528 KB Output is correct
25 Correct 126 ms 23500 KB Output is correct
26 Correct 92 ms 17464 KB Output is correct
27 Correct 106 ms 18420 KB Output is correct
28 Correct 139 ms 18468 KB Output is correct
29 Correct 73 ms 12280 KB Output is correct
30 Correct 60 ms 12268 KB Output is correct
31 Correct 111 ms 18480 KB Output is correct
32 Correct 99 ms 18340 KB Output is correct
33 Correct 58 ms 12276 KB Output is correct
34 Correct 73 ms 11000 KB Output is correct
35 Correct 82 ms 18032 KB Output is correct
36 Correct 83 ms 18040 KB Output is correct
37 Correct 97 ms 18044 KB Output is correct
38 Correct 102 ms 18044 KB Output is correct
39 Correct 61 ms 12280 KB Output is correct
40 Correct 61 ms 12280 KB Output is correct
41 Correct 129 ms 18288 KB Output is correct
42 Correct 60 ms 12308 KB Output is correct
43 Correct 64 ms 12060 KB Output is correct
44 Correct 110 ms 18032 KB Output is correct
45 Correct 87 ms 18064 KB Output is correct
46 Correct 66 ms 12028 KB Output is correct
47 Correct 84 ms 18068 KB Output is correct
48 Correct 57 ms 12008 KB Output is correct
49 Correct 91 ms 18028 KB Output is correct
50 Correct 98 ms 18288 KB Output is correct
51 Correct 99 ms 18292 KB Output is correct
52 Correct 78 ms 12284 KB Output is correct
53 Correct 97 ms 18068 KB Output is correct
54 Correct 87 ms 17908 KB Output is correct
55 Correct 61 ms 12348 KB Output is correct
56 Correct 108 ms 18172 KB Output is correct
57 Correct 59 ms 12276 KB Output is correct
58 Correct 85 ms 12308 KB Output is correct
59 Correct 67 ms 12204 KB Output is correct
60 Correct 105 ms 18048 KB Output is correct
61 Correct 65 ms 12284 KB Output is correct
62 Correct 84 ms 12536 KB Output is correct
63 Correct 106 ms 17780 KB Output is correct
64 Correct 69 ms 12012 KB Output is correct
65 Correct 69 ms 12316 KB Output is correct
66 Correct 110 ms 17772 KB Output is correct
67 Correct 97 ms 17924 KB Output is correct
68 Correct 78 ms 12292 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 12496 KB Output is correct
2 Correct 75 ms 10732 KB Output is correct
3 Correct 47 ms 10204 KB Output is correct
4 Correct 44 ms 9548 KB Output is correct
5 Correct 57 ms 10996 KB Output is correct
6 Correct 25 ms 5464 KB Output is correct
7 Correct 1 ms 360 KB Output is correct
8 Correct 1 ms 360 KB Output is correct
9 Correct 0 ms 360 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 352 KB Output is correct
13 Correct 1 ms 360 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 352 KB Output is correct
16 Correct 63 ms 11712 KB Output is correct
17 Correct 21 ms 7124 KB Output is correct
18 Correct 53 ms 7428 KB Output is correct
19 Correct 19 ms 4680 KB Output is correct
20 Correct 70 ms 8824 KB Output is correct
21 Correct 19 ms 5572 KB Output is correct
22 Correct 17 ms 6984 KB Output is correct
23 Correct 19 ms 6612 KB Output is correct
24 Correct 17 ms 6644 KB Output is correct
25 Correct 30 ms 6980 KB Output is correct
26 Correct 23 ms 6472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 18236 KB Output is correct
2 Correct 120 ms 18268 KB Output is correct
3 Correct 103 ms 18436 KB Output is correct
4 Correct 146 ms 18444 KB Output is correct
5 Correct 112 ms 18280 KB Output is correct
6 Correct 93 ms 18124 KB Output is correct
7 Correct 92 ms 18044 KB Output is correct
8 Correct 115 ms 18284 KB Output is correct
9 Correct 100 ms 18072 KB Output is correct
10 Correct 94 ms 18288 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 2 ms 1016 KB Output is correct
15 Correct 59 ms 14312 KB Output is correct
16 Correct 111 ms 23412 KB Output is correct
17 Correct 108 ms 23528 KB Output is correct
18 Correct 126 ms 23500 KB Output is correct
19 Correct 92 ms 17464 KB Output is correct
20 Correct 61 ms 12496 KB Output is correct
21 Correct 75 ms 10732 KB Output is correct
22 Correct 47 ms 10204 KB Output is correct
23 Correct 44 ms 9548 KB Output is correct
24 Correct 57 ms 10996 KB Output is correct
25 Correct 25 ms 5464 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 2 ms 604 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 3 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 3 ms 604 KB Output is correct
34 Correct 11 ms 3424 KB Output is correct
35 Correct 51 ms 12016 KB Output is correct
36 Correct 77 ms 11632 KB Output is correct
37 Correct 44 ms 10984 KB Output is correct
38 Correct 52 ms 10768 KB Output is correct
39 Correct 50 ms 10824 KB Output is correct
40 Correct 98 ms 16956 KB Output is correct
41 Correct 83 ms 14032 KB Output is correct
42 Correct 28 ms 8036 KB Output is correct
43 Correct 32 ms 8140 KB Output is correct
44 Correct 49 ms 8432 KB Output is correct
45 Correct 37 ms 8528 KB Output is correct
46 Correct 76 ms 13560 KB Output is correct
47 Correct 81 ms 13612 KB Output is correct
48 Correct 79 ms 13420 KB Output is correct
49 Correct 129 ms 12936 KB Output is correct
50 Correct 86 ms 12736 KB Output is correct
51 Correct 89 ms 12756 KB Output is correct
52 Correct 85 ms 12604 KB Output is correct
53 Correct 86 ms 12584 KB Output is correct
54 Correct 75 ms 12460 KB Output is correct
55 Correct 19 ms 4584 KB Output is correct
56 Correct 67 ms 10800 KB Output is correct
57 Correct 57 ms 10256 KB Output is correct
58 Correct 70 ms 11112 KB Output is correct
59 Correct 98 ms 11396 KB Output is correct
60 Correct 110 ms 12648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 360 KB Output is correct
2 Correct 1 ms 360 KB Output is correct
3 Correct 0 ms 360 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 352 KB Output is correct
7 Correct 1 ms 360 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 2 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 3 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 3 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 3 ms 604 KB Output is correct
20 Correct 4 ms 912 KB Output is correct
21 Correct 4 ms 860 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 3 ms 656 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 3 ms 860 KB Output is correct
26 Correct 3 ms 604 KB Output is correct
27 Correct 3 ms 600 KB Output is correct
28 Correct 3 ms 768 KB Output is correct
29 Correct 2 ms 604 KB Output is correct
30 Correct 2 ms 776 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 2 ms 616 KB Output is correct
33 Correct 0 ms 360 KB Output is correct
34 Correct 0 ms 352 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 0 ms 400 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 2 ms 604 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 129 ms 29452 KB Output is correct
9 Correct 113 ms 18380 KB Output is correct
10 Correct 82 ms 18488 KB Output is correct
11 Correct 117 ms 18236 KB Output is correct
12 Correct 120 ms 18268 KB Output is correct
13 Correct 103 ms 18436 KB Output is correct
14 Correct 146 ms 18444 KB Output is correct
15 Correct 112 ms 18280 KB Output is correct
16 Correct 93 ms 18124 KB Output is correct
17 Correct 92 ms 18044 KB Output is correct
18 Correct 115 ms 18284 KB Output is correct
19 Correct 100 ms 18072 KB Output is correct
20 Correct 94 ms 18288 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 2 ms 1016 KB Output is correct
25 Correct 59 ms 14312 KB Output is correct
26 Correct 111 ms 23412 KB Output is correct
27 Correct 108 ms 23528 KB Output is correct
28 Correct 126 ms 23500 KB Output is correct
29 Correct 92 ms 17464 KB Output is correct
30 Correct 106 ms 18420 KB Output is correct
31 Correct 139 ms 18468 KB Output is correct
32 Correct 73 ms 12280 KB Output is correct
33 Correct 60 ms 12268 KB Output is correct
34 Correct 111 ms 18480 KB Output is correct
35 Correct 99 ms 18340 KB Output is correct
36 Correct 58 ms 12276 KB Output is correct
37 Correct 73 ms 11000 KB Output is correct
38 Correct 82 ms 18032 KB Output is correct
39 Correct 83 ms 18040 KB Output is correct
40 Correct 97 ms 18044 KB Output is correct
41 Correct 102 ms 18044 KB Output is correct
42 Correct 61 ms 12280 KB Output is correct
43 Correct 61 ms 12280 KB Output is correct
44 Correct 129 ms 18288 KB Output is correct
45 Correct 60 ms 12308 KB Output is correct
46 Correct 64 ms 12060 KB Output is correct
47 Correct 110 ms 18032 KB Output is correct
48 Correct 87 ms 18064 KB Output is correct
49 Correct 66 ms 12028 KB Output is correct
50 Correct 84 ms 18068 KB Output is correct
51 Correct 57 ms 12008 KB Output is correct
52 Correct 91 ms 18028 KB Output is correct
53 Correct 98 ms 18288 KB Output is correct
54 Correct 99 ms 18292 KB Output is correct
55 Correct 78 ms 12284 KB Output is correct
56 Correct 97 ms 18068 KB Output is correct
57 Correct 87 ms 17908 KB Output is correct
58 Correct 61 ms 12348 KB Output is correct
59 Correct 108 ms 18172 KB Output is correct
60 Correct 59 ms 12276 KB Output is correct
61 Correct 85 ms 12308 KB Output is correct
62 Correct 67 ms 12204 KB Output is correct
63 Correct 105 ms 18048 KB Output is correct
64 Correct 65 ms 12284 KB Output is correct
65 Correct 84 ms 12536 KB Output is correct
66 Correct 106 ms 17780 KB Output is correct
67 Correct 69 ms 12012 KB Output is correct
68 Correct 69 ms 12316 KB Output is correct
69 Correct 110 ms 17772 KB Output is correct
70 Correct 97 ms 17924 KB Output is correct
71 Correct 78 ms 12292 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 61 ms 12496 KB Output is correct
75 Correct 75 ms 10732 KB Output is correct
76 Correct 47 ms 10204 KB Output is correct
77 Correct 44 ms 9548 KB Output is correct
78 Correct 57 ms 10996 KB Output is correct
79 Correct 25 ms 5464 KB Output is correct
80 Correct 1 ms 360 KB Output is correct
81 Correct 1 ms 360 KB Output is correct
82 Correct 0 ms 360 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 0 ms 344 KB Output is correct
85 Correct 1 ms 352 KB Output is correct
86 Correct 1 ms 360 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 352 KB Output is correct
89 Correct 63 ms 11712 KB Output is correct
90 Correct 21 ms 7124 KB Output is correct
91 Correct 53 ms 7428 KB Output is correct
92 Correct 19 ms 4680 KB Output is correct
93 Correct 70 ms 8824 KB Output is correct
94 Correct 19 ms 5572 KB Output is correct
95 Correct 17 ms 6984 KB Output is correct
96 Correct 19 ms 6612 KB Output is correct
97 Correct 17 ms 6644 KB Output is correct
98 Correct 30 ms 6980 KB Output is correct
99 Correct 23 ms 6472 KB Output is correct
100 Correct 1 ms 604 KB Output is correct
101 Correct 1 ms 604 KB Output is correct
102 Correct 2 ms 604 KB Output is correct
103 Correct 1 ms 604 KB Output is correct
104 Correct 1 ms 604 KB Output is correct
105 Correct 3 ms 604 KB Output is correct
106 Correct 2 ms 604 KB Output is correct
107 Correct 3 ms 604 KB Output is correct
108 Correct 11 ms 3424 KB Output is correct
109 Correct 51 ms 12016 KB Output is correct
110 Correct 77 ms 11632 KB Output is correct
111 Correct 44 ms 10984 KB Output is correct
112 Correct 52 ms 10768 KB Output is correct
113 Correct 50 ms 10824 KB Output is correct
114 Correct 98 ms 16956 KB Output is correct
115 Correct 83 ms 14032 KB Output is correct
116 Correct 28 ms 8036 KB Output is correct
117 Correct 32 ms 8140 KB Output is correct
118 Correct 49 ms 8432 KB Output is correct
119 Correct 37 ms 8528 KB Output is correct
120 Correct 76 ms 13560 KB Output is correct
121 Correct 81 ms 13612 KB Output is correct
122 Correct 79 ms 13420 KB Output is correct
123 Correct 129 ms 12936 KB Output is correct
124 Correct 86 ms 12736 KB Output is correct
125 Correct 89 ms 12756 KB Output is correct
126 Correct 85 ms 12604 KB Output is correct
127 Correct 86 ms 12584 KB Output is correct
128 Correct 75 ms 12460 KB Output is correct
129 Correct 19 ms 4584 KB Output is correct
130 Correct 67 ms 10800 KB Output is correct
131 Correct 57 ms 10256 KB Output is correct
132 Correct 70 ms 11112 KB Output is correct
133 Correct 98 ms 11396 KB Output is correct
134 Correct 110 ms 12648 KB Output is correct
135 Correct 3 ms 604 KB Output is correct
136 Correct 3 ms 604 KB Output is correct
137 Correct 4 ms 912 KB Output is correct
138 Correct 4 ms 860 KB Output is correct
139 Correct 2 ms 604 KB Output is correct
140 Correct 3 ms 656 KB Output is correct
141 Correct 3 ms 860 KB Output is correct
142 Correct 3 ms 860 KB Output is correct
143 Correct 3 ms 604 KB Output is correct
144 Correct 3 ms 600 KB Output is correct
145 Correct 3 ms 768 KB Output is correct
146 Correct 2 ms 604 KB Output is correct
147 Correct 2 ms 776 KB Output is correct
148 Correct 2 ms 604 KB Output is correct
149 Correct 2 ms 616 KB Output is correct
150 Correct 0 ms 360 KB Output is correct
151 Correct 0 ms 352 KB Output is correct
152 Correct 1 ms 348 KB Output is correct
153 Correct 1 ms 348 KB Output is correct
154 Correct 1 ms 348 KB Output is correct
155 Correct 1 ms 604 KB Output is correct
156 Correct 1 ms 348 KB Output is correct
157 Correct 0 ms 400 KB Output is correct
158 Correct 1 ms 344 KB Output is correct
159 Correct 2 ms 604 KB Output is correct
160 Correct 1 ms 604 KB Output is correct
161 Correct 1 ms 600 KB Output is correct
162 Correct 79 ms 11952 KB Output is correct
163 Correct 4 ms 1368 KB Output is correct
164 Correct 10 ms 2396 KB Output is correct
165 Correct 25 ms 4016 KB Output is correct
166 Correct 30 ms 6196 KB Output is correct
167 Correct 54 ms 10352 KB Output is correct
168 Correct 19 ms 5604 KB Output is correct
169 Correct 22 ms 5844 KB Output is correct
170 Correct 25 ms 5960 KB Output is correct
171 Correct 27 ms 5956 KB Output is correct
172 Correct 9 ms 1532 KB Output is correct
173 Correct 10 ms 1628 KB Output is correct
174 Correct 8 ms 1744 KB Output is correct
175 Correct 8 ms 1552 KB Output is correct
176 Correct 8 ms 1812 KB Output is correct
177 Correct 9 ms 2136 KB Output is correct
178 Correct 79 ms 10932 KB Output is correct
179 Correct 74 ms 10948 KB Output is correct
180 Correct 62 ms 13344 KB Output is correct
181 Correct 59 ms 13364 KB Output is correct
182 Correct 45 ms 8984 KB Output is correct
183 Correct 50 ms 8980 KB Output is correct
184 Correct 67 ms 12888 KB Output is correct
185 Correct 54 ms 8632 KB Output is correct
186 Correct 54 ms 8696 KB Output is correct
187 Correct 49 ms 8708 KB Output is correct
188 Correct 63 ms 12428 KB Output is correct
189 Correct 57 ms 8464 KB Output is correct
190 Correct 54 ms 8432 KB Output is correct
191 Correct 64 ms 8332 KB Output is correct
192 Correct 70 ms 13440 KB Output is correct
193 Correct 101 ms 13412 KB Output is correct
194 Correct 58 ms 8980 KB Output is correct
195 Correct 51 ms 9232 KB Output is correct
196 Correct 90 ms 13016 KB Output is correct
197 Correct 58 ms 8644 KB Output is correct
198 Correct 61 ms 8756 KB Output is correct
199 Correct 79 ms 8532 KB Output is correct
200 Correct 78 ms 12524 KB Output is correct
201 Correct 49 ms 8352 KB Output is correct
202 Correct 69 ms 8452 KB Output is correct
203 Correct 60 ms 8628 KB Output is correct
204 Correct 72 ms 13428 KB Output is correct
205 Correct 54 ms 8924 KB Output is correct
206 Correct 52 ms 8976 KB Output is correct
207 Correct 50 ms 9016 KB Output is correct
208 Correct 91 ms 12636 KB Output is correct
209 Correct 53 ms 8716 KB Output is correct
210 Correct 48 ms 8700 KB Output is correct
211 Correct 68 ms 12596 KB Output is correct
212 Correct 66 ms 12332 KB Output is correct
213 Correct 72 ms 12332 KB Output is correct
214 Correct 48 ms 8444 KB Output is correct
215 Correct 51 ms 8588 KB Output is correct
216 Correct 14 ms 3284 KB Output is correct
217 Correct 40 ms 6724 KB Output is correct
218 Correct 42 ms 9728 KB Output is correct
219 Correct 45 ms 10436 KB Output is correct
220 Correct 59 ms 7088 KB Output is correct
221 Correct 61 ms 11864 KB Output is correct