답안 #161351

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
161351 2019-11-01T21:32:26 Z pink_bittern Segments (IZhO18_segments) C++14
75 / 100
5000 ms 15656 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;
const ll block = 290;
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;
     ^
# 결과 실행 시간 메모리 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 9 ms 2040 KB Output is correct
5 Correct 16 ms 2296 KB Output is correct
6 Correct 18 ms 2296 KB Output is correct
7 Correct 42 ms 2168 KB Output is correct
8 Correct 43 ms 2304 KB Output is correct
9 Correct 44 ms 2168 KB Output is correct
10 Correct 19 ms 2296 KB Output is correct
11 Correct 26 ms 2172 KB Output is correct
12 Correct 26 ms 2168 KB Output is correct
13 Correct 20 ms 2296 KB Output is correct
14 Correct 51 ms 2284 KB Output is correct
15 Correct 10 ms 2168 KB Output is correct
16 Correct 11 ms 2168 KB Output is correct
17 Correct 49 ms 2172 KB Output is correct
18 Correct 30 ms 2296 KB Output is correct
19 Correct 51 ms 2168 KB Output is correct
20 Correct 48 ms 2296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1450 ms 6160 KB Output is correct
2 Correct 1445 ms 6060 KB Output is correct
3 Correct 1655 ms 6224 KB Output is correct
4 Correct 1389 ms 6264 KB Output is correct
5 Correct 356 ms 7428 KB Output is correct
6 Correct 226 ms 7644 KB Output is correct
7 Correct 1449 ms 6192 KB Output is correct
8 Correct 1483 ms 6280 KB Output is correct
9 Correct 1485 ms 6244 KB Output is correct
10 Correct 1313 ms 4976 KB Output is correct
11 Correct 1453 ms 5192 KB Output is correct
12 Correct 1116 ms 7008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 207 ms 4352 KB Output is correct
2 Correct 169 ms 4368 KB Output is correct
3 Correct 316 ms 4452 KB Output is correct
4 Correct 171 ms 4340 KB Output is correct
5 Correct 586 ms 6748 KB Output is correct
6 Correct 933 ms 6120 KB Output is correct
7 Correct 656 ms 6504 KB Output is correct
8 Correct 222 ms 7424 KB Output is correct
9 Correct 657 ms 8620 KB Output is correct
10 Correct 1271 ms 7460 KB Output is correct
11 Correct 1042 ms 4940 KB Output is correct
12 Correct 1287 ms 7780 KB Output is correct
13 Correct 1426 ms 7180 KB Output is correct
14 Correct 1722 ms 5936 KB Output is correct
15 Correct 1722 ms 6692 KB Output is correct
16 Correct 1601 ms 6048 KB Output is correct
17 Correct 837 ms 6288 KB Output is correct
18 Correct 838 ms 6068 KB Output is correct
19 Correct 816 ms 6084 KB Output is correct
20 Correct 825 ms 6204 KB Output is correct
21 Correct 1151 ms 5676 KB Output is correct
22 Correct 1753 ms 6856 KB Output is correct
23 Correct 1646 ms 7468 KB Output is correct
24 Correct 1778 ms 7004 KB Output is correct
25 Correct 213 ms 5092 KB Output is correct
26 Correct 181 ms 5004 KB Output is correct
27 Correct 208 ms 5152 KB Output is correct
28 Correct 188 ms 5068 KB Output is correct
29 Correct 1697 ms 7792 KB Output is correct
30 Correct 1557 ms 7792 KB Output is correct
31 Correct 517 ms 9348 KB Output is correct
32 Correct 1263 ms 8004 KB Output is correct
33 Correct 1379 ms 7736 KB Output is correct
34 Correct 1682 ms 6580 KB Output is correct
35 Correct 1645 ms 7380 KB Output is correct
36 Correct 1318 ms 7828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 4744 KB Output is correct
2 Correct 176 ms 4744 KB Output is correct
3 Correct 182 ms 4872 KB Output is correct
4 Correct 191 ms 4748 KB Output is correct
5 Correct 934 ms 7168 KB Output is correct
6 Correct 1201 ms 4416 KB Output is correct
7 Correct 741 ms 7384 KB Output is correct
8 Correct 1454 ms 4628 KB Output is correct
9 Correct 1987 ms 6648 KB Output is correct
10 Correct 1570 ms 8264 KB Output is correct
11 Correct 1654 ms 5616 KB Output is correct
12 Correct 343 ms 8840 KB Output is correct
13 Correct 1597 ms 7420 KB Output is correct
14 Correct 1906 ms 6128 KB Output is correct
15 Correct 592 ms 8636 KB Output is correct
16 Correct 1556 ms 7572 KB Output is correct
17 Correct 1461 ms 5612 KB Output is correct
18 Correct 1451 ms 5652 KB Output is correct
19 Correct 1443 ms 5728 KB Output is correct
20 Correct 1461 ms 5672 KB Output is correct
# 결과 실행 시간 메모리 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 9 ms 2040 KB Output is correct
5 Correct 16 ms 2296 KB Output is correct
6 Correct 18 ms 2296 KB Output is correct
7 Correct 42 ms 2168 KB Output is correct
8 Correct 43 ms 2304 KB Output is correct
9 Correct 44 ms 2168 KB Output is correct
10 Correct 19 ms 2296 KB Output is correct
11 Correct 26 ms 2172 KB Output is correct
12 Correct 26 ms 2168 KB Output is correct
13 Correct 20 ms 2296 KB Output is correct
14 Correct 51 ms 2284 KB Output is correct
15 Correct 10 ms 2168 KB Output is correct
16 Correct 11 ms 2168 KB Output is correct
17 Correct 49 ms 2172 KB Output is correct
18 Correct 30 ms 2296 KB Output is correct
19 Correct 51 ms 2168 KB Output is correct
20 Correct 48 ms 2296 KB Output is correct
21 Correct 1450 ms 6160 KB Output is correct
22 Correct 1445 ms 6060 KB Output is correct
23 Correct 1655 ms 6224 KB Output is correct
24 Correct 1389 ms 6264 KB Output is correct
25 Correct 356 ms 7428 KB Output is correct
26 Correct 226 ms 7644 KB Output is correct
27 Correct 1449 ms 6192 KB Output is correct
28 Correct 1483 ms 6280 KB Output is correct
29 Correct 1485 ms 6244 KB Output is correct
30 Correct 1313 ms 4976 KB Output is correct
31 Correct 1453 ms 5192 KB Output is correct
32 Correct 1116 ms 7008 KB Output is correct
33 Correct 168 ms 4744 KB Output is correct
34 Correct 176 ms 4744 KB Output is correct
35 Correct 182 ms 4872 KB Output is correct
36 Correct 191 ms 4748 KB Output is correct
37 Correct 934 ms 7168 KB Output is correct
38 Correct 1201 ms 4416 KB Output is correct
39 Correct 741 ms 7384 KB Output is correct
40 Correct 1454 ms 4628 KB Output is correct
41 Correct 1987 ms 6648 KB Output is correct
42 Correct 1570 ms 8264 KB Output is correct
43 Correct 1654 ms 5616 KB Output is correct
44 Correct 343 ms 8840 KB Output is correct
45 Correct 1597 ms 7420 KB Output is correct
46 Correct 1906 ms 6128 KB Output is correct
47 Correct 592 ms 8636 KB Output is correct
48 Correct 1556 ms 7572 KB Output is correct
49 Correct 1461 ms 5612 KB Output is correct
50 Correct 1451 ms 5652 KB Output is correct
51 Correct 1443 ms 5728 KB Output is correct
52 Correct 1461 ms 5672 KB Output is correct
53 Correct 202 ms 4360 KB Output is correct
54 Correct 202 ms 4328 KB Output is correct
55 Correct 173 ms 4316 KB Output is correct
56 Correct 182 ms 4252 KB Output is correct
57 Correct 1490 ms 4656 KB Output is correct
58 Correct 1056 ms 3704 KB Output is correct
59 Correct 1317 ms 5892 KB Output is correct
60 Correct 1000 ms 3784 KB Output is correct
61 Correct 1715 ms 7136 KB Output is correct
62 Correct 731 ms 8276 KB Output is correct
63 Correct 450 ms 8608 KB Output is correct
64 Correct 687 ms 8392 KB Output is correct
65 Correct 1736 ms 5432 KB Output is correct
66 Correct 1667 ms 4892 KB Output is correct
67 Correct 1467 ms 7124 KB Output is correct
68 Correct 1778 ms 6816 KB Output is correct
69 Correct 1455 ms 5624 KB Output is correct
70 Correct 1458 ms 5692 KB Output is correct
71 Correct 1489 ms 5688 KB Output is correct
72 Correct 1474 ms 5724 KB Output is correct
73 Correct 1924 ms 5984 KB Output is correct
74 Correct 1880 ms 6708 KB Output is correct
75 Correct 195 ms 7540 KB Output is correct
76 Correct 419 ms 8980 KB Output is correct
77 Correct 183 ms 4584 KB Output is correct
78 Correct 182 ms 4584 KB Output is correct
79 Correct 200 ms 4580 KB Output is correct
80 Correct 182 ms 4740 KB Output is correct
81 Correct 1939 ms 6728 KB Output is correct
82 Correct 1950 ms 5860 KB Output is correct
83 Correct 1621 ms 5236 KB Output is correct
84 Correct 1893 ms 6660 KB Output is correct
85 Correct 1442 ms 7500 KB Output is correct
86 Correct 1390 ms 8032 KB Output is correct
87 Correct 2005 ms 6268 KB Output is correct
88 Correct 1608 ms 5352 KB Output is correct
# 결과 실행 시간 메모리 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 9 ms 2040 KB Output is correct
5 Correct 16 ms 2296 KB Output is correct
6 Correct 18 ms 2296 KB Output is correct
7 Correct 42 ms 2168 KB Output is correct
8 Correct 43 ms 2304 KB Output is correct
9 Correct 44 ms 2168 KB Output is correct
10 Correct 19 ms 2296 KB Output is correct
11 Correct 26 ms 2172 KB Output is correct
12 Correct 26 ms 2168 KB Output is correct
13 Correct 20 ms 2296 KB Output is correct
14 Correct 51 ms 2284 KB Output is correct
15 Correct 10 ms 2168 KB Output is correct
16 Correct 11 ms 2168 KB Output is correct
17 Correct 49 ms 2172 KB Output is correct
18 Correct 30 ms 2296 KB Output is correct
19 Correct 51 ms 2168 KB Output is correct
20 Correct 48 ms 2296 KB Output is correct
21 Correct 1450 ms 6160 KB Output is correct
22 Correct 1445 ms 6060 KB Output is correct
23 Correct 1655 ms 6224 KB Output is correct
24 Correct 1389 ms 6264 KB Output is correct
25 Correct 356 ms 7428 KB Output is correct
26 Correct 226 ms 7644 KB Output is correct
27 Correct 1449 ms 6192 KB Output is correct
28 Correct 1483 ms 6280 KB Output is correct
29 Correct 1485 ms 6244 KB Output is correct
30 Correct 1313 ms 4976 KB Output is correct
31 Correct 1453 ms 5192 KB Output is correct
32 Correct 1116 ms 7008 KB Output is correct
33 Correct 207 ms 4352 KB Output is correct
34 Correct 169 ms 4368 KB Output is correct
35 Correct 316 ms 4452 KB Output is correct
36 Correct 171 ms 4340 KB Output is correct
37 Correct 586 ms 6748 KB Output is correct
38 Correct 933 ms 6120 KB Output is correct
39 Correct 656 ms 6504 KB Output is correct
40 Correct 222 ms 7424 KB Output is correct
41 Correct 657 ms 8620 KB Output is correct
42 Correct 1271 ms 7460 KB Output is correct
43 Correct 1042 ms 4940 KB Output is correct
44 Correct 1287 ms 7780 KB Output is correct
45 Correct 1426 ms 7180 KB Output is correct
46 Correct 1722 ms 5936 KB Output is correct
47 Correct 1722 ms 6692 KB Output is correct
48 Correct 1601 ms 6048 KB Output is correct
49 Correct 837 ms 6288 KB Output is correct
50 Correct 838 ms 6068 KB Output is correct
51 Correct 816 ms 6084 KB Output is correct
52 Correct 825 ms 6204 KB Output is correct
53 Correct 1151 ms 5676 KB Output is correct
54 Correct 1753 ms 6856 KB Output is correct
55 Correct 1646 ms 7468 KB Output is correct
56 Correct 1778 ms 7004 KB Output is correct
57 Correct 213 ms 5092 KB Output is correct
58 Correct 181 ms 5004 KB Output is correct
59 Correct 208 ms 5152 KB Output is correct
60 Correct 188 ms 5068 KB Output is correct
61 Correct 1697 ms 7792 KB Output is correct
62 Correct 1557 ms 7792 KB Output is correct
63 Correct 517 ms 9348 KB Output is correct
64 Correct 1263 ms 8004 KB Output is correct
65 Correct 1379 ms 7736 KB Output is correct
66 Correct 1682 ms 6580 KB Output is correct
67 Correct 1645 ms 7380 KB Output is correct
68 Correct 1318 ms 7828 KB Output is correct
69 Correct 168 ms 4744 KB Output is correct
70 Correct 176 ms 4744 KB Output is correct
71 Correct 182 ms 4872 KB Output is correct
72 Correct 191 ms 4748 KB Output is correct
73 Correct 934 ms 7168 KB Output is correct
74 Correct 1201 ms 4416 KB Output is correct
75 Correct 741 ms 7384 KB Output is correct
76 Correct 1454 ms 4628 KB Output is correct
77 Correct 1987 ms 6648 KB Output is correct
78 Correct 1570 ms 8264 KB Output is correct
79 Correct 1654 ms 5616 KB Output is correct
80 Correct 343 ms 8840 KB Output is correct
81 Correct 1597 ms 7420 KB Output is correct
82 Correct 1906 ms 6128 KB Output is correct
83 Correct 592 ms 8636 KB Output is correct
84 Correct 1556 ms 7572 KB Output is correct
85 Correct 1461 ms 5612 KB Output is correct
86 Correct 1451 ms 5652 KB Output is correct
87 Correct 1443 ms 5728 KB Output is correct
88 Correct 1461 ms 5672 KB Output is correct
89 Correct 202 ms 4360 KB Output is correct
90 Correct 202 ms 4328 KB Output is correct
91 Correct 173 ms 4316 KB Output is correct
92 Correct 182 ms 4252 KB Output is correct
93 Correct 1490 ms 4656 KB Output is correct
94 Correct 1056 ms 3704 KB Output is correct
95 Correct 1317 ms 5892 KB Output is correct
96 Correct 1000 ms 3784 KB Output is correct
97 Correct 1715 ms 7136 KB Output is correct
98 Correct 731 ms 8276 KB Output is correct
99 Correct 450 ms 8608 KB Output is correct
100 Correct 687 ms 8392 KB Output is correct
101 Correct 1736 ms 5432 KB Output is correct
102 Correct 1667 ms 4892 KB Output is correct
103 Correct 1467 ms 7124 KB Output is correct
104 Correct 1778 ms 6816 KB Output is correct
105 Correct 1455 ms 5624 KB Output is correct
106 Correct 1458 ms 5692 KB Output is correct
107 Correct 1489 ms 5688 KB Output is correct
108 Correct 1474 ms 5724 KB Output is correct
109 Correct 1924 ms 5984 KB Output is correct
110 Correct 1880 ms 6708 KB Output is correct
111 Correct 195 ms 7540 KB Output is correct
112 Correct 419 ms 8980 KB Output is correct
113 Correct 183 ms 4584 KB Output is correct
114 Correct 182 ms 4584 KB Output is correct
115 Correct 200 ms 4580 KB Output is correct
116 Correct 182 ms 4740 KB Output is correct
117 Correct 1939 ms 6728 KB Output is correct
118 Correct 1950 ms 5860 KB Output is correct
119 Correct 1621 ms 5236 KB Output is correct
120 Correct 1893 ms 6660 KB Output is correct
121 Correct 1442 ms 7500 KB Output is correct
122 Correct 1390 ms 8032 KB Output is correct
123 Correct 2005 ms 6268 KB Output is correct
124 Correct 1608 ms 5352 KB Output is correct
125 Correct 503 ms 6948 KB Output is correct
126 Correct 489 ms 6864 KB Output is correct
127 Correct 634 ms 6860 KB Output is correct
128 Correct 494 ms 6844 KB Output is correct
129 Correct 441 ms 7164 KB Output is correct
130 Correct 598 ms 6936 KB Output is correct
131 Correct 2998 ms 6124 KB Output is correct
132 Correct 4654 ms 8972 KB Output is correct
133 Correct 4078 ms 10844 KB Output is correct
134 Correct 3647 ms 6768 KB Output is correct
135 Correct 3657 ms 11300 KB Output is correct
136 Correct 1777 ms 5252 KB Output is correct
137 Correct 1851 ms 15260 KB Output is correct
138 Correct 4867 ms 11704 KB Output is correct
139 Correct 4061 ms 14904 KB Output is correct
140 Correct 2514 ms 15656 KB Output is correct
141 Correct 4441 ms 13556 KB Output is correct
142 Correct 2993 ms 8856 KB Output is correct
143 Correct 4439 ms 9512 KB Output is correct
144 Correct 2066 ms 8420 KB Output is correct
145 Correct 2434 ms 15280 KB Output is correct
146 Correct 4981 ms 10808 KB Output is correct
147 Correct 4602 ms 9672 KB Output is correct
148 Correct 4324 ms 10008 KB Output is correct
149 Correct 4709 ms 9884 KB Output is correct
150 Correct 4713 ms 9812 KB Output is correct
151 Correct 4699 ms 9652 KB Output is correct
152 Correct 4634 ms 10132 KB Output is correct
153 Correct 4691 ms 10152 KB Output is correct
154 Correct 4599 ms 10340 KB Output is correct
155 Correct 4006 ms 9520 KB Output is correct
156 Correct 4861 ms 9992 KB Output is correct
157 Correct 2355 ms 14916 KB Output is correct
158 Correct 2200 ms 15236 KB Output is correct
159 Correct 4712 ms 12500 KB Output is correct
160 Execution timed out 5042 ms 10412 KB Time limit exceeded
161 Halted 0 ms 0 KB -