Submission #161336

# Submission time Handle Problem Language Result Execution time Memory
161336 2019-11-01T21:11:58 Z pink_bittern Segments (IZhO18_segments) C++14
75 / 100
5000 ms 13904 KB
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define MOMI using namespace std;
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#pragma optimize("TKACHENKO-GORYACHENKO")
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
 
typedef int ll;
 
typedef long double ld;
 
using namespace std;
 
const ll inf = 2e9 + 500;
const ll maxn = 2e5 + 100;
const ll block = 200;
const ll block_sz = (maxn + block - 1) / block;
 
ll n, m, k, t;
 
struct seg{
	ll l;
	ll r;
	inline ll sz() const {
		return r - l + 1;
	}
	ll i;
};
 
seg S[maxn];

ll ssz = 0;

vector <ll> lasts;
 
inline bool cmpl(const ll& a, const ll& b) {
	return S[a].l < S[b].l;
}
 
inline bool cmpr(const ll& a, const ll& b) {
	return S[a].r < S[b].r;
}
 
inline bool cmpsz(const ll& a, const ll& b) {
	return S[a].sz() < S[b].sz();
}
 
vector <ll> segsl;
vector <ll> segsr;
 
vector <ll> R[block];
 
vector <ll> L[block];
 
ll MNL[block];
ll MXL[block];
ll MNR[block];
ll MXR[block];
 
ll IL[maxn];
ll IR[maxn];
 
bool used[maxn];
 
inline void buildL(ll q) {
	ll w;
	sort(L[q].begin(), L[q].end(), cmpsz);
	MNL[q] = inf;
	MXL[q] = -inf;
	for (w = 0; w < L[q].size(); w++) {
		MNL[q] = min(MNL[q], S[L[q][w]].l);
		MXL[q] = max(MXL[q], S[L[q][w]].l);
	}
}
 
inline void buildR(ll q) {
	ll w;
 	MNR[q] = inf;
	MXR[q] = -inf;
	sort(R[q].begin(), R[q].end(), cmpsz);
	for (w = 0; w < R[q].size(); w++) {
		MNR[q] = min(MNR[q], S[R[q][w]].r);
		MXR[q] = max(MXR[q], S[R[q][w]].r);
	}
}

inline void mrgl() {
	ll i, j;
	vector <ll> ANS;
	while (i != segsl.size() && j != lasts.size()) {
		if (cmpl(segsl[i], lasts[j])) {
			ANS.pb(segsl[i]);
			i++;
		}
		else {
			ANS.pb(lasts[j]);
			j++;
		}
	}
	for (; i < segsl.size(); i++) {
		ANS.pb(segsl[i]);
	}
	for (; j < lasts.size(); j++) {
		ANS.pb(lasts[j]);
	}
	segsl = ANS;
}

inline void mrgr() {
	ll i, j;
	vector <ll> ANS;
	while (i != segsr.size() && j != lasts.size()) {
		if (cmpr(segsr[i], lasts[j])) {
			ANS.pb(segsr[i]);
			i++;
		}
		else {
			ANS.pb(lasts[j]);
			j++;
		}
	}
	for (; i < segsr.size(); i++) {
		ANS.pb(segsr[i]);
	}
	for (; j < lasts.size(); j++) {
		ANS.pb(lasts[j]);
	}
	segsr = ANS;
}
 
inline void rebuild() { 
	ll q, w;
	ll blocki = 0;
	for (q = 0; q < block; q++) {
		R[q].clear();
		L[q].clear();
	}
	sort(lasts.begin(), lasts.end(), cmpl);
	mrgl();
	// sort(segs.begin(), segs.end(), cmpl);
	for (auto p : segsl) {
		IL[p] = -1;
		if (used[p]) {
			continue;
		}
		if (L[blocki].size() > block_sz) {
			blocki++;
		}
		IL[p] = blocki;
		L[blocki].pb(p);
	}
	sort(lasts.begin(), lasts.end(), cmpr);
	mrgr();
	lasts.clear();
	blocki = 0;
	// sort(segs.begin(), segs.end(), cmpr);
	for (auto p: segsr) {
		IR[p] = -1;
		if (used[p]) {
			continue;
		}
		if (R[blocki].size() > block_sz) {
			blocki++;
		}
		IR[p] = blocki;
		R[blocki].pb(p);
	}
	for (q = 0; q < block; q++) {
		buildL(q);
	}
	for (q = 0; q < block; q++) {
		buildR(q);
	}
}
 
inline void add(seg a) {
	lasts.pb(a.i);
	// S.pb(a);
	S[ssz] = a;
	ssz++;
	// segs.push_back(a.i);
	IL[a.i] = IR[a.i] = -1;
}
 
inline void del(seg b) { 
	ll il = IL[b.i], ir = IR[b.i];
	used[b.i] = 1;
	if (il == -1) {
		return;
	}
	L[il].erase(find(L[il].begin(), L[il].end(), b.i));
	R[ir].erase(find(R[ir].begin(), R[ir].end(), b.i));
	buildL(il);
	buildR(ir);
}
 
inline ll slowL(ll i, ll x, ll l) {
	ll q;
	ll ans = 0;
	for (q = 0; q < L[i].size(); q++) {
		if (S[L[i][q]].l >= l && S[L[i][q]].sz() >= x) {
			ans++;
		}
	}
	return ans;
}
 
inline ll slowR(ll i, ll x, ll r) {
	ll q;
	ll ans = 0;
	for (q = 0; q < R[i].size(); q++) {
		if (S[R[i][q]].r <= r && S[R[i][q]].sz() >= x) {
			ans++;
		}
	}
	return ans;
}

inline ll bpl(ll i, ll x) {
	ll l = -1, r = L[i].size(), M;
	while (r - l > 1) {
		M = (l + r) / 2;
		if (S[L[i][M]].sz() >= x) {
			r = M;
		}
		else {
			l = M;
		}
	}
	return r;
}

inline ll bpr(ll i, ll x) {
	ll l = -1, r = R[i].size(), M;
	while (r - l > 1) {
		M = (l + r) / 2;
		if (S[R[i][M]].sz() >= x) {
			r = M;
		}
		else {
			l = M;
		}
	}
	return r;
}
 
inline ll fastL(ll i, ll x) {
	if (L[i].empty()) {
		return 0;
	}
	seg good;
	good.l = 0; good.r = x - 1; 
	S[ssz] = good;
	ll j = (lower_bound(L[i].begin(), L[i].end(), ssz, cmpsz) - L[i].begin());
	// S.pop_back();
	return L[i].size() - j;
}
 
inline ll fastR(ll i, ll x) {
	if (R[i].empty()) {
		return 0;
	}
	seg good;
	good.l = 0; good.r = x - 1;
	S[ssz] = good;
	ll j = (lower_bound(R[i].begin(), R[i].end(), ssz, cmpsz) - R[i].begin());
	// S.pop_back();
	return R[i].size() - j;
}
 
inline ll getansL(ll x, ll l) {
	ll q;
	ll ans = 0;
	for (q = 0; q < block; q++) {
		if (MNL[q] == inf) {
			continue;
		}
		if (MNL[q] >= l) {
			ans += fastL(q, x);
			continue;
		}
		if (MXL[q] < l) {
			continue;
		}
		ans += slowL(q, x, l);
	}
 
	for (q = 0; q < lasts.size(); q++) {
		if (used[lasts[q]]) {
			continue;
		}
		if (S[lasts[q]].l >= l && S[lasts[q]].sz() >= x) {
			ans++;
		}
	}
	return ans;
}
 
inline ll getansR(ll x, ll r) {
	ll q;
	ll ans = 0;
	ll cnt = 0;
	for (q = 0; q < block; q++) {
		if (MNR[q] == inf) {
			continue;
		}
		// if (q > 1) {
		// 	if (MXR[q - 1] > MNR[q]) {
		// 		exit(-1);
		// 	}
		// }
		if (MXR[q] <= r) {
			ll dans = fastR(q, x);
			ans += dans;
			continue;
		}
		if (MNR[q] > r) {
			continue;
		}
		/// MXR[q] > r && MNR[q] <= r, 
		ll dans = slowR(q, x, r);
		ans += dans;
		cnt++;
	}
	// if (cnt > 5) {
	// 	exit(-1);
	// }
	for (q = 0; q < lasts.size(); q++) {
		if (used[lasts[q]]) {
			continue;
		}
		if (S[lasts[q]].r <= r && S[lasts[q]].sz() >= x) {
			ans++;
		}
	}
	return ans;
}
 
inline ll answer(seg c, ll k) {
	if (c.sz() < k) {
		return 0;
	}
	ll q, w;
	ll ans = 0;
	ll lk = c.r - k + 2, rk = c.l + k - 2;
	ll allans = getansR(k, inf);
	ll dansl = getansL(k, lk);
	ll dansr = getansR(k, rk);
	ans = allans - dansr - dansl;
	return ans;
}
 
signed main() {
	ll q, w, e, a, b, c;
	pyshnapyshnakaa;
	cin >> n >> t;
	// cout << block_sz * block << endl;
	ll nxt = 0;
	ll lastans = 0;
	// ll cnt3 = 0;
	// segsl.reserve(n);
	// segsr.reserve(n);
	// S.reserve(n);
	for (q = 0; q < block; q++) {
		L[q].reserve(block_sz);
		R[q].reserve(block_sz);
	}
	for (q = 0; q < n; q++) {
		ll comm;
		cin >> comm;
		ll l, r;
		seg x;
		if (comm == 1) {
			cin >> l >> r;
			l ^= (lastans * t);
			r ^= (lastans * t);
			if (l > r) {
				swap(l, r);
			}
			x.l = l; x.r = r;
			x.i = ssz;
			add(x);
		}
		if (comm == 2) {
			cin >> a;
			a--;
			del(S[a]);
		}
		// if (cnt3 > 8e4 && n > 1e5) {
		// 	exit(-1);
		// }
		if (comm == 3) {
			// cnt3++;
			cin >> l >> r;
			l ^= (lastans * t);
			r ^= (lastans * t);
			if (lasts.size() >= block_sz) {
				rebuild();
			}
			if (l > r) {
				swap(l, r);
			} 
			x.l = l; x.r = r;
			cin >> c;
			lastans = answer(x, c);
			cout << lastans << '\n';
		}
	}
	return 0;
}

Compilation message

segments.cpp:7:0: warning: ignoring #pragma optimize  [-Wunknown-pragmas]
 #pragma optimize("TKACHENKO-GORYACHENKO")
 
segments.cpp: In function 'void buildL(ll)':
segments.cpp:74:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (w = 0; w < L[q].size(); w++) {
              ~~^~~~~~~~~~~~~
segments.cpp: In function 'void buildR(ll)':
segments.cpp:85:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (w = 0; w < R[q].size(); w++) {
              ~~^~~~~~~~~~~~~
segments.cpp: In function 'void mrgl()':
segments.cpp:94:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (i != segsl.size() && j != lasts.size()) {
         ~~^~~~~~~~~~~~~~~
segments.cpp:94:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (i != segsl.size() && j != lasts.size()) {
                              ~~^~~~~~~~~~~~~~~
segments.cpp:104:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (; i < segsl.size(); i++) {
         ~~^~~~~~~~~~~~~~
segments.cpp:107:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (; j < lasts.size(); j++) {
         ~~^~~~~~~~~~~~~~
segments.cpp: In function 'void mrgr()':
segments.cpp:116:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (i != segsr.size() && j != lasts.size()) {
         ~~^~~~~~~~~~~~~~~
segments.cpp:116:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (i != segsr.size() && j != lasts.size()) {
                              ~~^~~~~~~~~~~~~~~
segments.cpp:126:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (; i < segsr.size(); i++) {
         ~~^~~~~~~~~~~~~~
segments.cpp:129:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (; j < lasts.size(); j++) {
         ~~^~~~~~~~~~~~~~
segments.cpp: In function 'void rebuild()':
segments.cpp:136:8: warning: unused variable 'w' [-Wunused-variable]
  ll q, w;
        ^
segments.cpp: In function 'll slowL(ll, ll, ll)':
segments.cpp:204:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (q = 0; q < L[i].size(); q++) {
              ~~^~~~~~~~~~~~~
segments.cpp: In function 'll slowR(ll, ll, ll)':
segments.cpp:215:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (q = 0; q < R[i].size(); q++) {
              ~~^~~~~~~~~~~~~
segments.cpp: In function 'll getansL(ll, ll)':
segments.cpp:292:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (q = 0; q < lasts.size(); q++) {
              ~~^~~~~~~~~~~~~~
segments.cpp: In function 'll getansR(ll, ll)':
segments.cpp:332:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (q = 0; q < lasts.size(); q++) {
              ~~^~~~~~~~~~~~~~
segments.cpp: In function 'll answer(seg, ll)':
segments.cpp:347:5: warning: unused variable 'q' [-Wunused-variable]
  ll q, w;
     ^
segments.cpp:347:8: warning: unused variable 'w' [-Wunused-variable]
  ll q, w;
        ^
segments.cpp: In function 'int main()':
segments.cpp:358:8: warning: unused variable 'w' [-Wunused-variable]
  ll q, w, e, a, b, c;
        ^
segments.cpp:358:11: warning: unused variable 'e' [-Wunused-variable]
  ll q, w, e, a, b, c;
           ^
segments.cpp:358:17: warning: unused variable 'b' [-Wunused-variable]
  ll q, w, e, a, b, c;
                 ^
segments.cpp:362:5: warning: unused variable 'nxt' [-Wunused-variable]
  ll nxt = 0;
     ^~~
segments.cpp: In function 'void rebuild()':
segments.cpp:129:11: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for (; j < lasts.size(); j++) {
         ~~^~~~~~~~~~~~~~
segments.cpp:114:8: note: 'j' was declared here
  ll i, j;
        ^
segments.cpp:116:11: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
  while (i != segsr.size() && j != lasts.size()) {
         ~~^~~~~~~~~~~~~~~
segments.cpp:114:5: note: 'i' was declared here
  ll i, j;
     ^
segments.cpp:107:11: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for (; j < lasts.size(); j++) {
         ~~^~~~~~~~~~~~~~
segments.cpp:92:8: note: 'j' was declared here
  ll i, j;
        ^
segments.cpp:94:11: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
  while (i != segsl.size() && j != lasts.size()) {
         ~~^~~~~~~~~~~~~~~
segments.cpp:92:5: note: 'i' was declared here
  ll i, j;
     ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1912 KB Output is correct
2 Correct 3 ms 1912 KB Output is correct
3 Correct 10 ms 2168 KB Output is correct
4 Correct 10 ms 2040 KB Output is correct
5 Correct 17 ms 2208 KB Output is correct
6 Correct 21 ms 2296 KB Output is correct
7 Correct 37 ms 2168 KB Output is correct
8 Correct 54 ms 2248 KB Output is correct
9 Correct 56 ms 2168 KB Output is correct
10 Correct 24 ms 2424 KB Output is correct
11 Correct 31 ms 2168 KB Output is correct
12 Correct 30 ms 2168 KB Output is correct
13 Correct 25 ms 2296 KB Output is correct
14 Correct 60 ms 2168 KB Output is correct
15 Correct 9 ms 2168 KB Output is correct
16 Correct 11 ms 2168 KB Output is correct
17 Correct 61 ms 2168 KB Output is correct
18 Correct 38 ms 2168 KB Output is correct
19 Correct 96 ms 2168 KB Output is correct
20 Correct 60 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1484 ms 4892 KB Output is correct
2 Correct 1466 ms 4756 KB Output is correct
3 Correct 1480 ms 4860 KB Output is correct
4 Correct 1431 ms 5008 KB Output is correct
5 Correct 330 ms 6524 KB Output is correct
6 Correct 220 ms 6648 KB Output is correct
7 Correct 1502 ms 4876 KB Output is correct
8 Correct 1468 ms 4892 KB Output is correct
9 Correct 1496 ms 4980 KB Output is correct
10 Correct 1466 ms 3888 KB Output is correct
11 Correct 1579 ms 4232 KB Output is correct
12 Correct 1099 ms 6100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 204 ms 4156 KB Output is correct
2 Correct 175 ms 4148 KB Output is correct
3 Correct 314 ms 4136 KB Output is correct
4 Correct 174 ms 4216 KB Output is correct
5 Correct 638 ms 6152 KB Output is correct
6 Correct 841 ms 5412 KB Output is correct
7 Correct 753 ms 5872 KB Output is correct
8 Correct 222 ms 6820 KB Output is correct
9 Correct 566 ms 8100 KB Output is correct
10 Correct 1616 ms 7172 KB Output is correct
11 Correct 1181 ms 4584 KB Output is correct
12 Correct 1531 ms 7552 KB Output is correct
13 Correct 1748 ms 7000 KB Output is correct
14 Correct 2317 ms 5828 KB Output is correct
15 Correct 2370 ms 5860 KB Output is correct
16 Correct 2116 ms 5108 KB Output is correct
17 Correct 968 ms 5408 KB Output is correct
18 Correct 967 ms 5448 KB Output is correct
19 Correct 940 ms 5332 KB Output is correct
20 Correct 954 ms 5412 KB Output is correct
21 Correct 1455 ms 4824 KB Output is correct
22 Correct 2314 ms 5980 KB Output is correct
23 Correct 2078 ms 6472 KB Output is correct
24 Correct 2197 ms 6080 KB Output is correct
25 Correct 213 ms 4540 KB Output is correct
26 Correct 184 ms 4460 KB Output is correct
27 Correct 209 ms 4536 KB Output is correct
28 Correct 192 ms 4444 KB Output is correct
29 Correct 1883 ms 6924 KB Output is correct
30 Correct 1875 ms 6816 KB Output is correct
31 Correct 536 ms 8616 KB Output is correct
32 Correct 1558 ms 7184 KB Output is correct
33 Correct 1686 ms 7080 KB Output is correct
34 Correct 2205 ms 5768 KB Output is correct
35 Correct 2057 ms 6728 KB Output is correct
36 Correct 1585 ms 7528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 170 ms 4320 KB Output is correct
2 Correct 175 ms 4384 KB Output is correct
3 Correct 179 ms 4464 KB Output is correct
4 Correct 191 ms 4388 KB Output is correct
5 Correct 923 ms 6568 KB Output is correct
6 Correct 1348 ms 4272 KB Output is correct
7 Correct 751 ms 6972 KB Output is correct
8 Correct 1494 ms 4544 KB Output is correct
9 Correct 2469 ms 6332 KB Output is correct
10 Correct 1487 ms 8052 KB Output is correct
11 Correct 2167 ms 5068 KB Output is correct
12 Correct 361 ms 7512 KB Output is correct
13 Correct 1908 ms 6892 KB Output is correct
14 Correct 2420 ms 5864 KB Output is correct
15 Correct 636 ms 8336 KB Output is correct
16 Correct 1865 ms 6996 KB Output is correct
17 Correct 1541 ms 5440 KB Output is correct
18 Correct 1521 ms 5304 KB Output is correct
19 Correct 1510 ms 5344 KB Output is correct
20 Correct 1502 ms 5288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1912 KB Output is correct
2 Correct 3 ms 1912 KB Output is correct
3 Correct 10 ms 2168 KB Output is correct
4 Correct 10 ms 2040 KB Output is correct
5 Correct 17 ms 2208 KB Output is correct
6 Correct 21 ms 2296 KB Output is correct
7 Correct 37 ms 2168 KB Output is correct
8 Correct 54 ms 2248 KB Output is correct
9 Correct 56 ms 2168 KB Output is correct
10 Correct 24 ms 2424 KB Output is correct
11 Correct 31 ms 2168 KB Output is correct
12 Correct 30 ms 2168 KB Output is correct
13 Correct 25 ms 2296 KB Output is correct
14 Correct 60 ms 2168 KB Output is correct
15 Correct 9 ms 2168 KB Output is correct
16 Correct 11 ms 2168 KB Output is correct
17 Correct 61 ms 2168 KB Output is correct
18 Correct 38 ms 2168 KB Output is correct
19 Correct 96 ms 2168 KB Output is correct
20 Correct 60 ms 2168 KB Output is correct
21 Correct 1484 ms 4892 KB Output is correct
22 Correct 1466 ms 4756 KB Output is correct
23 Correct 1480 ms 4860 KB Output is correct
24 Correct 1431 ms 5008 KB Output is correct
25 Correct 330 ms 6524 KB Output is correct
26 Correct 220 ms 6648 KB Output is correct
27 Correct 1502 ms 4876 KB Output is correct
28 Correct 1468 ms 4892 KB Output is correct
29 Correct 1496 ms 4980 KB Output is correct
30 Correct 1466 ms 3888 KB Output is correct
31 Correct 1579 ms 4232 KB Output is correct
32 Correct 1099 ms 6100 KB Output is correct
33 Correct 170 ms 4320 KB Output is correct
34 Correct 175 ms 4384 KB Output is correct
35 Correct 179 ms 4464 KB Output is correct
36 Correct 191 ms 4388 KB Output is correct
37 Correct 923 ms 6568 KB Output is correct
38 Correct 1348 ms 4272 KB Output is correct
39 Correct 751 ms 6972 KB Output is correct
40 Correct 1494 ms 4544 KB Output is correct
41 Correct 2469 ms 6332 KB Output is correct
42 Correct 1487 ms 8052 KB Output is correct
43 Correct 2167 ms 5068 KB Output is correct
44 Correct 361 ms 7512 KB Output is correct
45 Correct 1908 ms 6892 KB Output is correct
46 Correct 2420 ms 5864 KB Output is correct
47 Correct 636 ms 8336 KB Output is correct
48 Correct 1865 ms 6996 KB Output is correct
49 Correct 1541 ms 5440 KB Output is correct
50 Correct 1521 ms 5304 KB Output is correct
51 Correct 1510 ms 5344 KB Output is correct
52 Correct 1502 ms 5288 KB Output is correct
53 Correct 204 ms 4124 KB Output is correct
54 Correct 200 ms 4148 KB Output is correct
55 Correct 172 ms 4068 KB Output is correct
56 Correct 179 ms 4124 KB Output is correct
57 Correct 1583 ms 4644 KB Output is correct
58 Correct 1283 ms 3716 KB Output is correct
59 Correct 1328 ms 5664 KB Output is correct
60 Correct 1218 ms 3716 KB Output is correct
61 Correct 1988 ms 7128 KB Output is correct
62 Correct 825 ms 8548 KB Output is correct
63 Correct 484 ms 8644 KB Output is correct
64 Correct 774 ms 8532 KB Output is correct
65 Correct 2238 ms 5572 KB Output is correct
66 Correct 2125 ms 5492 KB Output is correct
67 Correct 1777 ms 7412 KB Output is correct
68 Correct 2193 ms 6760 KB Output is correct
69 Correct 1487 ms 5792 KB Output is correct
70 Correct 1488 ms 5796 KB Output is correct
71 Correct 1483 ms 5848 KB Output is correct
72 Correct 1484 ms 5756 KB Output is correct
73 Correct 2409 ms 5824 KB Output is correct
74 Correct 2282 ms 6572 KB Output is correct
75 Correct 222 ms 7472 KB Output is correct
76 Correct 452 ms 8600 KB Output is correct
77 Correct 191 ms 4564 KB Output is correct
78 Correct 183 ms 4628 KB Output is correct
79 Correct 206 ms 4680 KB Output is correct
80 Correct 184 ms 4620 KB Output is correct
81 Correct 2318 ms 6580 KB Output is correct
82 Correct 2484 ms 5784 KB Output is correct
83 Correct 2094 ms 5284 KB Output is correct
84 Correct 2294 ms 6644 KB Output is correct
85 Correct 1697 ms 7236 KB Output is correct
86 Correct 1611 ms 7524 KB Output is correct
87 Correct 2368 ms 5976 KB Output is correct
88 Correct 2029 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1912 KB Output is correct
2 Correct 3 ms 1912 KB Output is correct
3 Correct 10 ms 2168 KB Output is correct
4 Correct 10 ms 2040 KB Output is correct
5 Correct 17 ms 2208 KB Output is correct
6 Correct 21 ms 2296 KB Output is correct
7 Correct 37 ms 2168 KB Output is correct
8 Correct 54 ms 2248 KB Output is correct
9 Correct 56 ms 2168 KB Output is correct
10 Correct 24 ms 2424 KB Output is correct
11 Correct 31 ms 2168 KB Output is correct
12 Correct 30 ms 2168 KB Output is correct
13 Correct 25 ms 2296 KB Output is correct
14 Correct 60 ms 2168 KB Output is correct
15 Correct 9 ms 2168 KB Output is correct
16 Correct 11 ms 2168 KB Output is correct
17 Correct 61 ms 2168 KB Output is correct
18 Correct 38 ms 2168 KB Output is correct
19 Correct 96 ms 2168 KB Output is correct
20 Correct 60 ms 2168 KB Output is correct
21 Correct 1484 ms 4892 KB Output is correct
22 Correct 1466 ms 4756 KB Output is correct
23 Correct 1480 ms 4860 KB Output is correct
24 Correct 1431 ms 5008 KB Output is correct
25 Correct 330 ms 6524 KB Output is correct
26 Correct 220 ms 6648 KB Output is correct
27 Correct 1502 ms 4876 KB Output is correct
28 Correct 1468 ms 4892 KB Output is correct
29 Correct 1496 ms 4980 KB Output is correct
30 Correct 1466 ms 3888 KB Output is correct
31 Correct 1579 ms 4232 KB Output is correct
32 Correct 1099 ms 6100 KB Output is correct
33 Correct 204 ms 4156 KB Output is correct
34 Correct 175 ms 4148 KB Output is correct
35 Correct 314 ms 4136 KB Output is correct
36 Correct 174 ms 4216 KB Output is correct
37 Correct 638 ms 6152 KB Output is correct
38 Correct 841 ms 5412 KB Output is correct
39 Correct 753 ms 5872 KB Output is correct
40 Correct 222 ms 6820 KB Output is correct
41 Correct 566 ms 8100 KB Output is correct
42 Correct 1616 ms 7172 KB Output is correct
43 Correct 1181 ms 4584 KB Output is correct
44 Correct 1531 ms 7552 KB Output is correct
45 Correct 1748 ms 7000 KB Output is correct
46 Correct 2317 ms 5828 KB Output is correct
47 Correct 2370 ms 5860 KB Output is correct
48 Correct 2116 ms 5108 KB Output is correct
49 Correct 968 ms 5408 KB Output is correct
50 Correct 967 ms 5448 KB Output is correct
51 Correct 940 ms 5332 KB Output is correct
52 Correct 954 ms 5412 KB Output is correct
53 Correct 1455 ms 4824 KB Output is correct
54 Correct 2314 ms 5980 KB Output is correct
55 Correct 2078 ms 6472 KB Output is correct
56 Correct 2197 ms 6080 KB Output is correct
57 Correct 213 ms 4540 KB Output is correct
58 Correct 184 ms 4460 KB Output is correct
59 Correct 209 ms 4536 KB Output is correct
60 Correct 192 ms 4444 KB Output is correct
61 Correct 1883 ms 6924 KB Output is correct
62 Correct 1875 ms 6816 KB Output is correct
63 Correct 536 ms 8616 KB Output is correct
64 Correct 1558 ms 7184 KB Output is correct
65 Correct 1686 ms 7080 KB Output is correct
66 Correct 2205 ms 5768 KB Output is correct
67 Correct 2057 ms 6728 KB Output is correct
68 Correct 1585 ms 7528 KB Output is correct
69 Correct 170 ms 4320 KB Output is correct
70 Correct 175 ms 4384 KB Output is correct
71 Correct 179 ms 4464 KB Output is correct
72 Correct 191 ms 4388 KB Output is correct
73 Correct 923 ms 6568 KB Output is correct
74 Correct 1348 ms 4272 KB Output is correct
75 Correct 751 ms 6972 KB Output is correct
76 Correct 1494 ms 4544 KB Output is correct
77 Correct 2469 ms 6332 KB Output is correct
78 Correct 1487 ms 8052 KB Output is correct
79 Correct 2167 ms 5068 KB Output is correct
80 Correct 361 ms 7512 KB Output is correct
81 Correct 1908 ms 6892 KB Output is correct
82 Correct 2420 ms 5864 KB Output is correct
83 Correct 636 ms 8336 KB Output is correct
84 Correct 1865 ms 6996 KB Output is correct
85 Correct 1541 ms 5440 KB Output is correct
86 Correct 1521 ms 5304 KB Output is correct
87 Correct 1510 ms 5344 KB Output is correct
88 Correct 1502 ms 5288 KB Output is correct
89 Correct 204 ms 4124 KB Output is correct
90 Correct 200 ms 4148 KB Output is correct
91 Correct 172 ms 4068 KB Output is correct
92 Correct 179 ms 4124 KB Output is correct
93 Correct 1583 ms 4644 KB Output is correct
94 Correct 1283 ms 3716 KB Output is correct
95 Correct 1328 ms 5664 KB Output is correct
96 Correct 1218 ms 3716 KB Output is correct
97 Correct 1988 ms 7128 KB Output is correct
98 Correct 825 ms 8548 KB Output is correct
99 Correct 484 ms 8644 KB Output is correct
100 Correct 774 ms 8532 KB Output is correct
101 Correct 2238 ms 5572 KB Output is correct
102 Correct 2125 ms 5492 KB Output is correct
103 Correct 1777 ms 7412 KB Output is correct
104 Correct 2193 ms 6760 KB Output is correct
105 Correct 1487 ms 5792 KB Output is correct
106 Correct 1488 ms 5796 KB Output is correct
107 Correct 1483 ms 5848 KB Output is correct
108 Correct 1484 ms 5756 KB Output is correct
109 Correct 2409 ms 5824 KB Output is correct
110 Correct 2282 ms 6572 KB Output is correct
111 Correct 222 ms 7472 KB Output is correct
112 Correct 452 ms 8600 KB Output is correct
113 Correct 191 ms 4564 KB Output is correct
114 Correct 183 ms 4628 KB Output is correct
115 Correct 206 ms 4680 KB Output is correct
116 Correct 184 ms 4620 KB Output is correct
117 Correct 2318 ms 6580 KB Output is correct
118 Correct 2484 ms 5784 KB Output is correct
119 Correct 2094 ms 5284 KB Output is correct
120 Correct 2294 ms 6644 KB Output is correct
121 Correct 1697 ms 7236 KB Output is correct
122 Correct 1611 ms 7524 KB Output is correct
123 Correct 2368 ms 5976 KB Output is correct
124 Correct 2029 ms 4992 KB Output is correct
125 Correct 457 ms 6432 KB Output is correct
126 Correct 469 ms 6452 KB Output is correct
127 Correct 610 ms 6420 KB Output is correct
128 Correct 501 ms 6340 KB Output is correct
129 Correct 436 ms 6392 KB Output is correct
130 Correct 538 ms 6448 KB Output is correct
131 Correct 3358 ms 5336 KB Output is correct
132 Correct 4581 ms 8140 KB Output is correct
133 Correct 3612 ms 9456 KB Output is correct
134 Correct 4030 ms 5344 KB Output is correct
135 Correct 3282 ms 9884 KB Output is correct
136 Correct 2179 ms 4028 KB Output is correct
137 Correct 1902 ms 13904 KB Output is correct
138 Execution timed out 5058 ms 10628 KB Time limit exceeded
139 Halted 0 ms 0 KB -