답안 #887531

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887531 2023-12-14T17:25:52 Z 42kangaroo 참나무 (IOI23_beechtree) C++17
71 / 100
2000 ms 292780 KB
//  D. Beech Tree

#include<bits/stdc++.h>
#include "beechtree.h"

#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

using namespace std;

using g_t = vector<vector<int>>;

struct dVal {
	unordered_map<int, int> de;
	list<set<pair<int, int>>> se;
	int seSi;
};

struct unordered_mapsVal {
	map<int, int> maDe;
	unordered_map<int, unordered_map<int, map<int, int>>> maCDe;
	unordered_map<int, map<int, int>> maCat;
	map<int, int> miDe;
	unordered_map<int, unordered_map<int, map<int, int>>> miCDe;
	map<int, map<int, int>> miCat;
};

struct sdVal {
	vector<pair<int, int>> edg;
	unordered_map<int, unordered_mapsVal> maV;
};


struct BFSSorting {
	int n, actDe, actC, pDe, pC, cat, pO;
};

bool operator<(const BFSSorting &l, const BFSSorting &r) {
	return tie(l.actDe, l.pDe, l.actC, l.pC, l.cat, r.pO) < tie(r.actDe, r.pDe, r.actC, r.pC, r.cat, l.pO);
}

vector<int> de;
vector<BFSSorting> de2;


dVal dfs(int n, g_t &g, vector<bool> &po, vector<int> &c) {
	unordered_map<int, int> r;
	unordered_map<int, vector<pair<int, int>>> ve;
	list<set<pair<int, int>>> se;
	unordered_map<int, unordered_map<int, int>> OmiR;
	int seSi = 0;
	for (auto e: g[n]) {
		if (r.find(c[e]) != r.end()) po[n] = false;
		r[c[e]] = 1;
		ve[c[e]] = {};
	}
	for (auto e: g[n]) {
		auto [re, li, ssi] = dfs(e, g, po, c);
		if (!po[e]) {
			po[n] = false;
		}
		if (!po[n]) continue;
		for (auto &[co, d]: re) {
			if (r.find(co) == r.end()) {
				po[n] = false;
				break;
			}
			if (co == c[e]) r[c[e]] = d + 1;
			ve[co].emplace_back(d, e);
		}
		if (!po[n]) continue;
		if (ssi > seSi) {
			swap(se, li);
			swap(ssi, seSi);
		}
		auto itS = se.begin();
		for (auto &it: li) {
			while (itS != se.end() && itS->size() <= it.size()) {
				for (auto cos: *itS) {
					if (it.erase(cos) == 0) {
						po[n] = false;
						break;
					}
				}
				if (!po[n]) break;
				itS++;
			}
			if (!po[n]) break;
			if (!it.empty()) {
				auto act = se.insert(itS, set<pair<int, int>>());
				for (auto cos: it) {
					if (itS->erase(cos) == 0) {
						po[n] = false;
						break;
					}
					act->insert(cos);
				}
			}
			if (itS != se.end() && itS->empty()) itS++;
			if (!po[n]) break;
		}
	}
	if (!po[n]) return {};
	se.emplace_back();
	for (auto &[co, vec]: ve) {
		bool dD = true;
		for (auto [d, e]: vec) {
			if (d > r[co]) {
				po[n] = false;
				return {};
			} else if (d == r[co]) {
				dD = false;
				break;
			}
		}
		if (dD) {
			se.back().insert({co, r[co]});
			seSi++;
		}
	}
	if (se.back().empty()) se.pop_back();
	de[n] = seSi;
	return {std::move(r), std::move(se), seSi};
}

sdVal sdfs(int n, g_t &g, vector<bool> &po, vector<int> &c, vector<bool> &vis) {
	if (vis[n]) return {};
	vis[n] = true;
	sdVal res;
	for (auto e: g[n]) {
		auto re = sdfs(e, g, po, c, vis);
		if (!po[e]) po[n] = false;
		if (!po[n]) continue;
		if (re.edg.size() > res.edg.size()) {
			swap(re, res);
		}
		re.edg.emplace_back(e, n);
		for (auto &ed: re.edg) {
			res.edg.push_back(ed);
			auto &ch = de2[ed.first];
			auto up = res.maV[ch.actC].miDe.upper_bound(ch.pDe);
			if (up != res.maV[ch.actC].miDe.end() && up->second < ch.actDe) {
				po[n] = false;
				break;
			}
			if (res.maV[ch.actC].miDe.find(ch.pDe) == res.maV[ch.actC].miDe.end())
				res.maV[ch.actC].miDe[ch.pDe] = ch.actDe;
			res.maV[ch.actC].miDe[ch.pDe] = min(res.maV[ch.actC].miDe[ch.pDe], ch.actDe);
			up = res.maV[ch.actC].miCDe[ch.pC][ch.pDe].upper_bound(de2[ed.second].pDe);
			if (up != res.maV[ch.actC].miCDe[ch.pC][ch.pDe].end() && up->second < ch.actDe) {
				po[n] = false;
				break;
			}
			if (res.maV[ch.actC].miCDe[ch.pC][ch.pDe].find(de2[ed.second].pDe) == res.maV[ch.actC].miCDe[ch.pC][ch.pDe].end())
				res.maV[ch.actC].miCDe[ch.pC][ch.pDe][de2[ed.second].pDe] = ch.actDe;
			res.maV[ch.actC].miCDe[ch.pC][ch.pDe][de2[ed.second].pDe] = min(
					res.maV[ch.actC].miCDe[ch.pC][ch.pDe][de2[ed.second].pDe], ch.actDe);
			up = res.maV[ch.actC].miCat[de2[ed.second].cat].upper_bound(-ch.pO);
			if (up != res.maV[ch.actC].miCat[de2[ed.second].cat].end() && up->second < ch.actDe) {
				po[n] = false;
				break;
			}
			if (res.maV[ch.actC].miCat[de2[ed.second].cat].find(-ch.pO) == res.maV[ch.actC].miCat[de2[ed.second].cat].end())
				res.maV[ch.actC].miCat[de2[ed.second].cat][-ch.pO] = ch.actDe;
			res.maV[ch.actC].miCat[de2[ed.second].cat][-ch.pO] = min(res.maV[ch.actC].miCat[de2[ed.second].cat][-ch.pO], ch.actDe);
			up = res.maV[ch.actC].maDe.upper_bound(-ch.pDe);
			if (up != res.maV[ch.actC].maDe.end() && up->second > ch.actDe) {
				po[n] = false;
				break;
			}
			if (res.maV[ch.actC].maDe.find(-ch.pDe) == res.maV[ch.actC].maDe.end())
				res.maV[ch.actC].maDe[-ch.pDe] = ch.actDe;
			res.maV[ch.actC].maDe[-ch.pDe] = max(res.maV[ch.actC].maDe[-ch.pDe], ch.actDe);
			up = res.maV[ch.actC].maCDe[ch.pC][ch.pDe].upper_bound(-de2[ed.second].pDe);
			if (up != res.maV[ch.actC].maCDe[ch.pC][ch.pDe].end() && up->second > ch.actDe) {
				po[n] = false;
				break;
			}
			if (res.maV[ch.actC].maCDe[ch.pC][ch.pDe].find(-de2[ed.second].pDe) == res.maV[ch.actC].maCDe[ch.pC][ch.pDe].end())
				res.maV[ch.actC].maCDe[ch.pC][ch.pDe][-de2[ed.second].pDe] = ch.actDe;
			res.maV[ch.actC].maCDe[ch.pC][ch.pDe][-de2[ed.second].pDe] = max(
					res.maV[ch.actC].maCDe[ch.pC][ch.pDe][-de2[ed.second].pDe], ch.actDe);
			up = res.maV[ch.actC].maCat[de2[ed.second].cat].upper_bound(ch.pO);
			if (up != res.maV[ch.actC].maCat[de2[ed.second].cat].end() && up->second > ch.actDe) {
				po[n] = false;
				break;
			}
			if (res.maV[ch.actC].maCat[de2[ed.second].cat].find(ch.pO) == res.maV[ch.actC].maCat[de2[ed.second].cat].end())
				res.maV[ch.actC].maCat[de2[ed.second].cat][ch.pO] = ch.actDe;
			res.maV[ch.actC].maCat[de2[ed.second].cat][ch.pO] = max(res.maV[ch.actC].maCat[de2[ed.second].cat][ch.pO], ch.actDe);
		}
	}
	return std::move(res);
}

void bfs(int n, g_t &g, vector<int> &c, vector<bool> &vi) {
	int d = 0, col = 0;
	BFSSorting la{n, de[n], c[n], de[n], c[n], 0, 1};
	priority_queue<BFSSorting> pq;
	pq.push({n, de[n], c[n], de[n], c[n], 0, 1});
	while (!pq.empty()) {
		auto bO = pq.top();
		pq.pop();
		if (vi[bO.n]) continue;
		vi[bO.n] = true;
		if (bO.actDe != la.actDe || bO.pDe != la.pDe || bO.pO != la.pO) {
			d++;
		}
		if (bO.actC != la.actC || bO.pC != la.pC || bO.cat != la.cat || bO.actDe != la.actDe || bO.pDe != la.pDe) {
			col++;
		}
		de2[bO.n] = la = {bO.n, bO.actDe, bO.actC, bO.pDe, bO.pC, col, d};
		for (auto e: g[bO.n]) {
			pq.push({e, de[e], c[e], de[bO.n], c[bO.n], de2[bO.n].cat, de2[bO.n].pO});
		}
	}
}

vector<int> beechtree(int N, int M, vector<int> P, vector<int> C) {
	g_t g(N);
	for (int i = 1; i < N; ++i) {
		g[P[i]].push_back(i);
	}
	de = vector<int>(N);
	de2 = vector<BFSSorting>(N);
	vector<bool> po(N, true);
	dfs(0, g, po, C);
	vector<bool> vis(N, false);
	for (int i = 0; i < N; ++i) {
		if (po[i]) {
			bfs(i, g, C, vis);
		}
	}
	std::fill(vis.begin(), vis.end(), false);
	for (int i = 0; i < N; ++i) {
		if (po[i]) {
			sdfs(i, g, po, C, vis);
		}
	}
	return {po.begin(), po.end()};
}

//#ifndef EVAL
//
//signed main() {
//	ios_base::sync_with_stdio(false);
//	cin.tie(nullptr);
//	int n, m;
//	cin >> n >> m;
//	vector<int> p(n), c(n);
//	for (auto &e: p) {
//		cin >> e;
//	}
//	for (auto &e: c) {
//		cin >> e;
//	}
//	auto res = beechtree(n, m, p, c);
////	vector<int> ou{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//	for (auto e: res) {
//		cout << e << " ";
//	}
////	for (int i = 0; i < n; ++i) {
////		if (ou[i] != res[i]) cout << i << " ";
////	}
//	cout << "\n";
//}
//
//#endif

Compilation message

beechtree.cpp: In function 'sdVal sdfs(int, g_t&, std::vector<bool>&, std::vector<int>&, std::vector<bool>&)':
beechtree.cpp:193:18: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  193 |  return std::move(res);
      |         ~~~~~~~~~^~~~~
beechtree.cpp:193:18: note: remove 'std::move' call
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 684 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 432 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 356 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 436 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 352 KB Output is correct
25 Correct 1 ms 356 KB Output is correct
26 Correct 1 ms 436 KB Output is correct
27 Correct 1 ms 436 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 239 ms 214332 KB Output is correct
8 Correct 233 ms 214256 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 6 ms 3164 KB Output is correct
14 Correct 5 ms 2908 KB Output is correct
15 Correct 3 ms 2500 KB Output is correct
16 Correct 2 ms 2396 KB Output is correct
17 Correct 1038 ms 292780 KB Output is correct
18 Correct 731 ms 240736 KB Output is correct
19 Correct 321 ms 214308 KB Output is correct
20 Correct 238 ms 214176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 440 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 440 KB Output is correct
10 Correct 1 ms 436 KB Output is correct
11 Correct 4 ms 440 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 3 ms 460 KB Output is correct
14 Correct 6 ms 1628 KB Output is correct
15 Correct 329 ms 10568 KB Output is correct
16 Correct 293 ms 9872 KB Output is correct
17 Correct 322 ms 9976 KB Output is correct
18 Correct 1022 ms 111724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 239 ms 214332 KB Output is correct
6 Correct 233 ms 214256 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 4 ms 604 KB Output is correct
10 Correct 3 ms 604 KB Output is correct
11 Correct 320 ms 33416 KB Output is correct
12 Correct 377 ms 41916 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 432 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 424 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 684 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 356 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 436 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 352 KB Output is correct
28 Correct 1 ms 356 KB Output is correct
29 Correct 1 ms 436 KB Output is correct
30 Correct 1 ms 436 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 352 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 440 KB Output is correct
44 Correct 1 ms 436 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 440 KB Output is correct
51 Correct 1 ms 436 KB Output is correct
52 Correct 1 ms 428 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 2 ms 436 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 2 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 2 ms 348 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 1 ms 428 KB Output is correct
63 Correct 1 ms 444 KB Output is correct
64 Correct 1 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 684 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 432 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 356 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 436 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 352 KB Output is correct
21 Correct 1 ms 356 KB Output is correct
22 Correct 1 ms 436 KB Output is correct
23 Correct 1 ms 436 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 6 ms 3164 KB Output is correct
26 Correct 5 ms 2752 KB Output is correct
27 Correct 6 ms 2904 KB Output is correct
28 Correct 2 ms 2396 KB Output is correct
29 Correct 8 ms 3164 KB Output is correct
30 Correct 5 ms 1116 KB Output is correct
31 Correct 12 ms 1440 KB Output is correct
32 Correct 8 ms 604 KB Output is correct
33 Correct 5 ms 604 KB Output is correct
34 Correct 13 ms 1372 KB Output is correct
35 Correct 12 ms 604 KB Output is correct
36 Correct 6 ms 604 KB Output is correct
37 Correct 5 ms 1380 KB Output is correct
38 Correct 4 ms 1112 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 432 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 424 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 684 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 356 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 436 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 352 KB Output is correct
28 Correct 1 ms 356 KB Output is correct
29 Correct 1 ms 436 KB Output is correct
30 Correct 1 ms 436 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 352 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 604 KB Output is correct
39 Correct 1 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 6 ms 3164 KB Output is correct
43 Correct 5 ms 2908 KB Output is correct
44 Correct 3 ms 2500 KB Output is correct
45 Correct 2 ms 2396 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 440 KB Output is correct
48 Correct 1 ms 436 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 440 KB Output is correct
55 Correct 1 ms 436 KB Output is correct
56 Correct 4 ms 440 KB Output is correct
57 Correct 3 ms 348 KB Output is correct
58 Correct 3 ms 460 KB Output is correct
59 Correct 6 ms 1628 KB Output is correct
60 Correct 1 ms 428 KB Output is correct
61 Correct 1 ms 348 KB Output is correct
62 Correct 4 ms 604 KB Output is correct
63 Correct 3 ms 604 KB Output is correct
64 Correct 2 ms 436 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 2 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 2 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 428 KB Output is correct
73 Correct 1 ms 444 KB Output is correct
74 Correct 1 ms 436 KB Output is correct
75 Correct 6 ms 3164 KB Output is correct
76 Correct 5 ms 2752 KB Output is correct
77 Correct 6 ms 2904 KB Output is correct
78 Correct 2 ms 2396 KB Output is correct
79 Correct 8 ms 3164 KB Output is correct
80 Correct 5 ms 1116 KB Output is correct
81 Correct 12 ms 1440 KB Output is correct
82 Correct 8 ms 604 KB Output is correct
83 Correct 5 ms 604 KB Output is correct
84 Correct 13 ms 1372 KB Output is correct
85 Correct 12 ms 604 KB Output is correct
86 Correct 6 ms 604 KB Output is correct
87 Correct 5 ms 1380 KB Output is correct
88 Correct 4 ms 1112 KB Output is correct
89 Correct 7 ms 2396 KB Output is correct
90 Correct 5 ms 860 KB Output is correct
91 Correct 16 ms 1332 KB Output is correct
92 Correct 10 ms 856 KB Output is correct
93 Correct 5 ms 604 KB Output is correct
94 Correct 12 ms 1368 KB Output is correct
95 Correct 13 ms 600 KB Output is correct
96 Correct 9 ms 604 KB Output is correct
97 Correct 5 ms 1628 KB Output is correct
98 Correct 5 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 424 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 684 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 432 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 356 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 436 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 352 KB Output is correct
21 Correct 1 ms 356 KB Output is correct
22 Correct 1 ms 436 KB Output is correct
23 Correct 1 ms 436 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 6 ms 3164 KB Output is correct
26 Correct 5 ms 2752 KB Output is correct
27 Correct 6 ms 2904 KB Output is correct
28 Correct 2 ms 2396 KB Output is correct
29 Correct 8 ms 3164 KB Output is correct
30 Correct 5 ms 1116 KB Output is correct
31 Correct 12 ms 1440 KB Output is correct
32 Correct 8 ms 604 KB Output is correct
33 Correct 5 ms 604 KB Output is correct
34 Correct 13 ms 1372 KB Output is correct
35 Correct 12 ms 604 KB Output is correct
36 Correct 6 ms 604 KB Output is correct
37 Correct 5 ms 1380 KB Output is correct
38 Correct 4 ms 1112 KB Output is correct
39 Correct 975 ms 291944 KB Output is correct
40 Correct 629 ms 231808 KB Output is correct
41 Correct 523 ms 215844 KB Output is correct
42 Correct 217 ms 213328 KB Output is correct
43 Correct 1062 ms 242096 KB Output is correct
44 Correct 711 ms 64632 KB Output is correct
45 Execution timed out 2082 ms 78288 KB Time limit exceeded
46 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 432 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 424 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 684 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 432 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 356 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 436 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 352 KB Output is correct
28 Correct 1 ms 356 KB Output is correct
29 Correct 1 ms 436 KB Output is correct
30 Correct 1 ms 436 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 352 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 239 ms 214332 KB Output is correct
39 Correct 233 ms 214256 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 1 ms 604 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 6 ms 3164 KB Output is correct
45 Correct 5 ms 2908 KB Output is correct
46 Correct 3 ms 2500 KB Output is correct
47 Correct 2 ms 2396 KB Output is correct
48 Correct 1038 ms 292780 KB Output is correct
49 Correct 731 ms 240736 KB Output is correct
50 Correct 321 ms 214308 KB Output is correct
51 Correct 238 ms 214176 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 440 KB Output is correct
54 Correct 1 ms 436 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 440 KB Output is correct
61 Correct 1 ms 436 KB Output is correct
62 Correct 4 ms 440 KB Output is correct
63 Correct 3 ms 348 KB Output is correct
64 Correct 3 ms 460 KB Output is correct
65 Correct 6 ms 1628 KB Output is correct
66 Correct 329 ms 10568 KB Output is correct
67 Correct 293 ms 9872 KB Output is correct
68 Correct 322 ms 9976 KB Output is correct
69 Correct 1022 ms 111724 KB Output is correct
70 Correct 1 ms 428 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 4 ms 604 KB Output is correct
73 Correct 3 ms 604 KB Output is correct
74 Correct 320 ms 33416 KB Output is correct
75 Correct 377 ms 41916 KB Output is correct
76 Correct 2 ms 436 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 1 ms 344 KB Output is correct
79 Correct 2 ms 348 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 2 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 428 KB Output is correct
85 Correct 1 ms 444 KB Output is correct
86 Correct 1 ms 436 KB Output is correct
87 Correct 6 ms 3164 KB Output is correct
88 Correct 5 ms 2752 KB Output is correct
89 Correct 6 ms 2904 KB Output is correct
90 Correct 2 ms 2396 KB Output is correct
91 Correct 8 ms 3164 KB Output is correct
92 Correct 5 ms 1116 KB Output is correct
93 Correct 12 ms 1440 KB Output is correct
94 Correct 8 ms 604 KB Output is correct
95 Correct 5 ms 604 KB Output is correct
96 Correct 13 ms 1372 KB Output is correct
97 Correct 12 ms 604 KB Output is correct
98 Correct 6 ms 604 KB Output is correct
99 Correct 5 ms 1380 KB Output is correct
100 Correct 4 ms 1112 KB Output is correct
101 Correct 7 ms 2396 KB Output is correct
102 Correct 5 ms 860 KB Output is correct
103 Correct 16 ms 1332 KB Output is correct
104 Correct 10 ms 856 KB Output is correct
105 Correct 5 ms 604 KB Output is correct
106 Correct 12 ms 1368 KB Output is correct
107 Correct 13 ms 600 KB Output is correct
108 Correct 9 ms 604 KB Output is correct
109 Correct 5 ms 1628 KB Output is correct
110 Correct 5 ms 1112 KB Output is correct
111 Correct 975 ms 291944 KB Output is correct
112 Correct 629 ms 231808 KB Output is correct
113 Correct 523 ms 215844 KB Output is correct
114 Correct 217 ms 213328 KB Output is correct
115 Correct 1062 ms 242096 KB Output is correct
116 Correct 711 ms 64632 KB Output is correct
117 Execution timed out 2082 ms 78288 KB Time limit exceeded
118 Halted 0 ms 0 KB -