답안 #799098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799098 2023-07-31T09:39:50 Z marvinthang 화성 (APIO22_mars) C++17
100 / 100
1874 ms 5408 KB
/*************************************
*    author: marvinthang             *
*    created: 20.04.2023 11:09:59    *
*************************************/
 
#include "mars.h"
#include <bits/stdc++.h>
 
using namespace std;
 
#define                  fi  first
#define                  se  second
#define                left  ___left
#define               right  ___right
#define                TIME  (1.0 * clock() / CLOCKS_PER_SEC)
#define             MASK(i)  (1LL << (i))
#define           BIT(x, i)  ((x) >> (i) & 1)
#define  __builtin_popcount  __builtin_popcountll
#define              ALL(v)  (v).begin(), (v).end()
#define           REP(i, n)  for (int i = 0, _n = (n); i < _n; ++i)
#define          REPD(i, n)  for (int i = (n); i--; )
#define        FOR(i, a, b)  for (int i = (a), _b = (b); i < _b; ++i) 
#define       FORD(i, b, a)  for (int i = (b), _a = (a); --i >= _a; ) 
#define       FORE(i, a, b)  for (int i = (a), _b = (b); i <= _b; ++i) 
#define      FORDE(i, b, a)  for (int i = (b), _a = (a); i >= _a; --i) 
#define        scan_op(...)  istream & operator >> (istream &in, __VA_ARGS__ &u)
#define       print_op(...)  ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
    #include "debug.h"
#else
    #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
    #define DB(...) 23
    #define db(...) 23
    #define debug(...) 23
#endif
 
template <class U, class V> scan_op(pair <U, V>)  { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>)  { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>)  { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")";  else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
 
// end of template
 
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
 
string process(vector <vector <string>> h, int i, int j, int k, int n) {
	int m = 2 * (n - k - 1);
	int sz = 2 * n + 1;
	string res(100, '0');
	vector board(sz, vector<char>(sz, '0'));
	vector comps(sz, vector<int>(sz));
	vector adj(sz, vector(sz, vector<pair<int, int>>()));

	auto bfs = [&] (int sx, int sy, int cl) {
		queue <pair <int, int>> q;
		q.emplace(sx, sy);
		comps[sx][sy] = cl;
		while (!q.empty()) {
			auto [x, y] = q.front(); q.pop();
			REP(d, 4) {
				int u = x + dx[d];
				int v = y + dy[d];
				if (u < 0 || v < 0 || u >= sz || v >= sz || board[u][v] == '0' || comps[u][v]) continue;
				comps[u][v] = cl;
				q.emplace(u, v);
			}
			for (auto [u, v]: adj[x][y]) {
				if (board[u][v] == '0' || comps[u][v]) continue;
				comps[u][v] = cl;
				q.emplace(u, v);
			}
		}
	};

	auto toBinary = [&] (int v, int len) {
		string res;
		REP(i, len) {
			res += '0' + (v & 1);
			v >>= 1;
		};
		return res;
	};
	auto toDecimal = [&] (const string &s, int l, int len) {
		int res = 0;
		FORD(i, l + len, l) res = res << 1 | (s[i] == '1');
		return res;
	};
	auto getBorder = [&] (int i, int j) {
		vector <pair <int, int>> res;
		if (!i) {
			if (!j) {
				REP(i, n + 1) res.emplace_back(n, i);
				REPD(i, n) res.emplace_back(i, n);
			} else {
				FORD(i, sz, n) res.emplace_back(n, i);
				REPD(i, n) res.emplace_back(i, n);
			}
		} else {
			if (!j) {
				REP(i, n) res.emplace_back(n, i);
				FOR(i, n, sz) res.emplace_back(i, n);
			} else {
				FORD(i, sz, n) res.emplace_back(n, i);
				FOR(i, n + 1, sz) res.emplace_back(i, n);
			}
		}
		return res;
	};

	if (n == 1) {
		int cl = 0;
		REP(x, sz) REP(y, sz) board[x][y] = h[x][y][0];
		REP(x, sz) REP(y, sz) if (board[x][y] == '1' && !comps[x][y]) {
			++cl;
			bfs(x, y, cl);
		}
		return toBinary(cl, 100);
	}

	if (k == n - 1) {
		int res = 0;
		for (int i: {0, 2}) for (int j: {0, 2}) {
			res += toDecimal(h[i][j], 83, 17);
			vector border(getBorder(i, j));
			string mask = h[i][j].substr(0, 41);
			vector <int> head;
			REP(i, border.size()) {
				auto [x, y] = border[i];
				if (mask[i] == '1') {
					board[x][y] = '1';
					if (!i || mask[i - 1] == '0') head.push_back(i);
				}
			}
			string open(h[i][j].substr(41, 21)), close(h[i][j].substr(62, 21));
			stack <pair <int, int>> st;
			REP(i, head.size()) {
				int p = head[i];
				auto [x, y] = border[p];
				if (open[i] == '1') st.emplace(x, y);
				else {
					auto [u, v] = st.top();
					adj[x][y].emplace_back(u, v);
					adj[u][v].emplace_back(x, y);
				}
				if (close[i] == '1') st.pop();
			}
		}
		REP(x, sz) REP(y, sz) if (board[x][y] == '1' && !comps[x][y]) {
			++res;
			bfs(x, y, res);
		}
		return toBinary(res, 100);
	}

	auto get_first = [&] (int i, int k) {
		if (k == n - 1) return !i ? 0 : i == 1 ? n + 1 : i == 2 ? n : sz;
		return min(max(i, i * n / 2), i + 2 * k);
	};

	int li = get_first(i, k + 1), lj = get_first(j, k + 1);
	int ri = get_first(i + 1, k + 1), rj = get_first(j + 1, k + 1);
	REP(tx, 3) REP(ty, 3) {
		int lx = get_first(i + tx, k), ly = get_first(j + ty, k);
		int rx = get_first(i + tx + 1, k), ry = get_first(j + ty + 1, k);
		FOR(x, lx, rx) FOR(y, ly, ry) board[x][y] = h[tx][ty][(x - lx) * 10 + (y - ly)];
	}

	if (k == n - 2) {
		if (i & 1 || j & 1) return res;
		REP(x, sz) REP(y, sz) if (x < li || x >= ri || y < lj || y >= rj) board[x][y] = '0';
		vector border(getBorder(i, j));
		int cl = 0;
		for (auto [x, y]: border) if (board[x][y] == '1' && !comps[x][y]) {
			++cl;
			bfs(x, y, cl);
		}
		int res = 0;
		FOR(x, li, ri) FOR(y, lj, rj) if (board[x][y] == '1' && !comps[x][y]) {
			++res;
			bfs(x, y, res);
		}
		bool first = true;
		string mask(41, '0');
		vector <int> head;
		REP(i, border.size()) {
			auto [x, y] = border[i];
			if (board[x][y] == '1') {
				mask[i] = '1';
				if (!i || board[border[i - 1].fi][border[i - 1].se] == '0') head.push_back(i);
			}
		}
		string open(21, '0'), close(21, '0');
		vector <bool> used(cl + 1);
		REP(i, head.size()) {
			int p = head[i];
			auto [x, y] = border[p];
			if (!used[comps[x][y]]) {
				used[comps[x][y]] = true;
				open[i] = '1';
			}
		}
		REPD(i, head.size()) {
			int p = head[i];
			auto [x, y] = border[p];
			if (used[comps[x][y]]) {
				used[comps[x][y]] = false;
				close[i] = '1';
			}
		}
		return mask + open + close + toBinary(res, 17);
	}

	int cur = 0;
	FOR(x, li, ri) FOR(y, lj, rj) res[(x - li) * 10 + (y - lj)] = board[x][y];
	return res;
}
 
#ifdef LOCAL
#include "mars.h"
 
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <string>
#include <bitset>
 
using namespace std;
 
static void WA(string msg)
{
	cout << "WA: " << msg << endl;
	exit(0);
}
 
static long long to_longlong(string s)
{
  long long ans=0;
  for(int i=(int)s.size()-1;i>=0;i--)
    ans=(ans*2)+s[i]-'0';
  return ans;
}
 
int main()
{
	ios_base::sync_with_stdio(false);
	file("mars");
	int t;
	assert(scanf("%d",&t) == 1);
	while(t--)
	{
		int n;
		assert(scanf("%d",&n) == 1);
 
		vector <vector<char>> s(2*n+1, vector<char>(2*n+1));
		for(int i = 0; i < 2*n+1; i++) {
			for(int j = 0; j < 2*n+1; j++) {
				assert(scanf(" %c",&s[i][j]) == 1);
				// cout << s[i][j] << ' ';
			}
			// cout << '\n';
		}
		// cout << string(10, '=') << '\n';
 
		vector <vector<string>> h(2*n+1, vector<string>(2*n+1, string(100 ,'0')));
		for(int i = 0; i < 2*n+1; i++)
			for(int j = 0; j < 2*n+1; j++)
				h[i][j][0] = s[i][j];
 
		vector <vector<string>> subarr(3, vector<string>(3));
		for(int k = 0; k < n; k++)
		{
			int m = 2*(n-k-1);
			for(int i = 0; i <= m; i++)
			{
				for(int j = 0; j <= m; j++)
				{
					for(int y = 0; y < 3; y++)
					{
						for(int x = 0; x < 3; x++)
						{
							subarr[y][x] = h[i+y][j+x];
						}
					}
					h[i][j] = process(subarr, i, j, k, n);
 
					if(h[i][j].size() != 100) WA("Invalid return length");
					for(int l = 0; l < 100; l++)
						if(h[i][j][l] != '0' && h[i][j][l] != '1') WA("Invalid return");
				}
			}
		}
		cout << to_longlong(h[0][0]) << '\n';
	}
}
#endif

Compilation message

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:185:8: warning: unused variable 'first' [-Wunused-variable]
  185 |   bool first = true;
      |        ^~~~~
mars.cpp:50:6: warning: unused variable 'm' [-Wunused-variable]
   50 |  int m = 2 * (n - k - 1);
      |      ^
mars.cpp:216:6: warning: unused variable 'cur' [-Wunused-variable]
  216 |  int cur = 0;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
29 Correct 108 ms 2796 KB Output is correct
30 Correct 148 ms 3152 KB Output is correct
31 Correct 138 ms 3076 KB Output is correct
32 Correct 140 ms 3124 KB Output is correct
33 Correct 139 ms 3060 KB Output is correct
34 Correct 153 ms 3208 KB Output is correct
35 Correct 147 ms 3068 KB Output is correct
36 Correct 145 ms 3140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
29 Correct 108 ms 2796 KB Output is correct
30 Correct 148 ms 3152 KB Output is correct
31 Correct 138 ms 3076 KB Output is correct
32 Correct 140 ms 3124 KB Output is correct
33 Correct 139 ms 3060 KB Output is correct
34 Correct 153 ms 3208 KB Output is correct
35 Correct 147 ms 3068 KB Output is correct
36 Correct 145 ms 3140 KB Output is correct
37 Correct 193 ms 3188 KB Output is correct
38 Correct 279 ms 3336 KB Output is correct
39 Correct 283 ms 3376 KB Output is correct
40 Correct 281 ms 3360 KB Output is correct
41 Correct 280 ms 3344 KB Output is correct
42 Correct 284 ms 3416 KB Output is correct
43 Correct 260 ms 3412 KB Output is correct
44 Correct 303 ms 3492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
29 Correct 108 ms 2796 KB Output is correct
30 Correct 148 ms 3152 KB Output is correct
31 Correct 138 ms 3076 KB Output is correct
32 Correct 140 ms 3124 KB Output is correct
33 Correct 139 ms 3060 KB Output is correct
34 Correct 153 ms 3208 KB Output is correct
35 Correct 147 ms 3068 KB Output is correct
36 Correct 145 ms 3140 KB Output is correct
37 Correct 193 ms 3188 KB Output is correct
38 Correct 279 ms 3336 KB Output is correct
39 Correct 283 ms 3376 KB Output is correct
40 Correct 281 ms 3360 KB Output is correct
41 Correct 280 ms 3344 KB Output is correct
42 Correct 284 ms 3416 KB Output is correct
43 Correct 260 ms 3412 KB Output is correct
44 Correct 303 ms 3492 KB Output is correct
45 Correct 352 ms 3604 KB Output is correct
46 Correct 496 ms 3588 KB Output is correct
47 Correct 471 ms 3712 KB Output is correct
48 Correct 488 ms 3596 KB Output is correct
49 Correct 472 ms 3776 KB Output is correct
50 Correct 454 ms 3704 KB Output is correct
51 Correct 498 ms 3568 KB Output is correct
52 Correct 493 ms 3784 KB Output is correct
53 Correct 475 ms 3664 KB Output is correct
54 Correct 481 ms 3592 KB Output is correct
55 Correct 498 ms 3652 KB Output is correct
56 Correct 463 ms 3668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
29 Correct 108 ms 2796 KB Output is correct
30 Correct 148 ms 3152 KB Output is correct
31 Correct 138 ms 3076 KB Output is correct
32 Correct 140 ms 3124 KB Output is correct
33 Correct 139 ms 3060 KB Output is correct
34 Correct 153 ms 3208 KB Output is correct
35 Correct 147 ms 3068 KB Output is correct
36 Correct 145 ms 3140 KB Output is correct
37 Correct 193 ms 3188 KB Output is correct
38 Correct 279 ms 3336 KB Output is correct
39 Correct 283 ms 3376 KB Output is correct
40 Correct 281 ms 3360 KB Output is correct
41 Correct 280 ms 3344 KB Output is correct
42 Correct 284 ms 3416 KB Output is correct
43 Correct 260 ms 3412 KB Output is correct
44 Correct 303 ms 3492 KB Output is correct
45 Correct 352 ms 3604 KB Output is correct
46 Correct 496 ms 3588 KB Output is correct
47 Correct 471 ms 3712 KB Output is correct
48 Correct 488 ms 3596 KB Output is correct
49 Correct 472 ms 3776 KB Output is correct
50 Correct 454 ms 3704 KB Output is correct
51 Correct 498 ms 3568 KB Output is correct
52 Correct 493 ms 3784 KB Output is correct
53 Correct 475 ms 3664 KB Output is correct
54 Correct 481 ms 3592 KB Output is correct
55 Correct 498 ms 3652 KB Output is correct
56 Correct 463 ms 3668 KB Output is correct
57 Correct 620 ms 4256 KB Output is correct
58 Correct 831 ms 4180 KB Output is correct
59 Correct 813 ms 4200 KB Output is correct
60 Correct 819 ms 4376 KB Output is correct
61 Correct 795 ms 4232 KB Output is correct
62 Correct 782 ms 4308 KB Output is correct
63 Correct 796 ms 4284 KB Output is correct
64 Correct 791 ms 4252 KB Output is correct
65 Correct 792 ms 4220 KB Output is correct
66 Correct 828 ms 4412 KB Output is correct
67 Correct 842 ms 4240 KB Output is correct
68 Correct 795 ms 4344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
29 Correct 108 ms 2796 KB Output is correct
30 Correct 148 ms 3152 KB Output is correct
31 Correct 138 ms 3076 KB Output is correct
32 Correct 140 ms 3124 KB Output is correct
33 Correct 139 ms 3060 KB Output is correct
34 Correct 153 ms 3208 KB Output is correct
35 Correct 147 ms 3068 KB Output is correct
36 Correct 145 ms 3140 KB Output is correct
37 Correct 193 ms 3188 KB Output is correct
38 Correct 279 ms 3336 KB Output is correct
39 Correct 283 ms 3376 KB Output is correct
40 Correct 281 ms 3360 KB Output is correct
41 Correct 280 ms 3344 KB Output is correct
42 Correct 284 ms 3416 KB Output is correct
43 Correct 260 ms 3412 KB Output is correct
44 Correct 303 ms 3492 KB Output is correct
45 Correct 352 ms 3604 KB Output is correct
46 Correct 496 ms 3588 KB Output is correct
47 Correct 471 ms 3712 KB Output is correct
48 Correct 488 ms 3596 KB Output is correct
49 Correct 472 ms 3776 KB Output is correct
50 Correct 454 ms 3704 KB Output is correct
51 Correct 498 ms 3568 KB Output is correct
52 Correct 493 ms 3784 KB Output is correct
53 Correct 475 ms 3664 KB Output is correct
54 Correct 481 ms 3592 KB Output is correct
55 Correct 498 ms 3652 KB Output is correct
56 Correct 463 ms 3668 KB Output is correct
57 Correct 620 ms 4256 KB Output is correct
58 Correct 831 ms 4180 KB Output is correct
59 Correct 813 ms 4200 KB Output is correct
60 Correct 819 ms 4376 KB Output is correct
61 Correct 795 ms 4232 KB Output is correct
62 Correct 782 ms 4308 KB Output is correct
63 Correct 796 ms 4284 KB Output is correct
64 Correct 791 ms 4252 KB Output is correct
65 Correct 792 ms 4220 KB Output is correct
66 Correct 828 ms 4412 KB Output is correct
67 Correct 842 ms 4240 KB Output is correct
68 Correct 795 ms 4344 KB Output is correct
69 Correct 995 ms 4476 KB Output is correct
70 Correct 1239 ms 4764 KB Output is correct
71 Correct 1279 ms 4668 KB Output is correct
72 Correct 1234 ms 4704 KB Output is correct
73 Correct 1206 ms 4820 KB Output is correct
74 Correct 1282 ms 4620 KB Output is correct
75 Correct 1234 ms 4656 KB Output is correct
76 Correct 1245 ms 4908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1892 KB Output is correct
2 Correct 6 ms 1768 KB Output is correct
3 Correct 6 ms 1948 KB Output is correct
4 Correct 6 ms 1988 KB Output is correct
5 Correct 8 ms 2092 KB Output is correct
6 Correct 6 ms 1812 KB Output is correct
7 Correct 8 ms 2172 KB Output is correct
8 Correct 11 ms 1952 KB Output is correct
9 Correct 13 ms 1600 KB Output is correct
10 Correct 15 ms 2284 KB Output is correct
11 Correct 11 ms 1940 KB Output is correct
12 Correct 10 ms 2116 KB Output is correct
13 Correct 11 ms 2192 KB Output is correct
14 Correct 19 ms 2500 KB Output is correct
15 Correct 27 ms 2572 KB Output is correct
16 Correct 25 ms 2552 KB Output is correct
17 Correct 28 ms 2572 KB Output is correct
18 Correct 30 ms 2532 KB Output is correct
19 Correct 28 ms 2608 KB Output is correct
20 Correct 28 ms 2624 KB Output is correct
21 Correct 41 ms 2724 KB Output is correct
22 Correct 68 ms 2756 KB Output is correct
23 Correct 66 ms 2748 KB Output is correct
24 Correct 69 ms 2836 KB Output is correct
25 Correct 72 ms 2708 KB Output is correct
26 Correct 68 ms 2732 KB Output is correct
27 Correct 69 ms 2756 KB Output is correct
28 Correct 72 ms 2780 KB Output is correct
29 Correct 108 ms 2796 KB Output is correct
30 Correct 148 ms 3152 KB Output is correct
31 Correct 138 ms 3076 KB Output is correct
32 Correct 140 ms 3124 KB Output is correct
33 Correct 139 ms 3060 KB Output is correct
34 Correct 153 ms 3208 KB Output is correct
35 Correct 147 ms 3068 KB Output is correct
36 Correct 145 ms 3140 KB Output is correct
37 Correct 193 ms 3188 KB Output is correct
38 Correct 279 ms 3336 KB Output is correct
39 Correct 283 ms 3376 KB Output is correct
40 Correct 281 ms 3360 KB Output is correct
41 Correct 280 ms 3344 KB Output is correct
42 Correct 284 ms 3416 KB Output is correct
43 Correct 260 ms 3412 KB Output is correct
44 Correct 303 ms 3492 KB Output is correct
45 Correct 352 ms 3604 KB Output is correct
46 Correct 496 ms 3588 KB Output is correct
47 Correct 471 ms 3712 KB Output is correct
48 Correct 488 ms 3596 KB Output is correct
49 Correct 472 ms 3776 KB Output is correct
50 Correct 454 ms 3704 KB Output is correct
51 Correct 498 ms 3568 KB Output is correct
52 Correct 493 ms 3784 KB Output is correct
53 Correct 475 ms 3664 KB Output is correct
54 Correct 481 ms 3592 KB Output is correct
55 Correct 498 ms 3652 KB Output is correct
56 Correct 463 ms 3668 KB Output is correct
57 Correct 620 ms 4256 KB Output is correct
58 Correct 831 ms 4180 KB Output is correct
59 Correct 813 ms 4200 KB Output is correct
60 Correct 819 ms 4376 KB Output is correct
61 Correct 795 ms 4232 KB Output is correct
62 Correct 782 ms 4308 KB Output is correct
63 Correct 796 ms 4284 KB Output is correct
64 Correct 791 ms 4252 KB Output is correct
65 Correct 792 ms 4220 KB Output is correct
66 Correct 828 ms 4412 KB Output is correct
67 Correct 842 ms 4240 KB Output is correct
68 Correct 795 ms 4344 KB Output is correct
69 Correct 995 ms 4476 KB Output is correct
70 Correct 1239 ms 4764 KB Output is correct
71 Correct 1279 ms 4668 KB Output is correct
72 Correct 1234 ms 4704 KB Output is correct
73 Correct 1206 ms 4820 KB Output is correct
74 Correct 1282 ms 4620 KB Output is correct
75 Correct 1234 ms 4656 KB Output is correct
76 Correct 1245 ms 4908 KB Output is correct
77 Correct 1201 ms 4564 KB Output is correct
78 Correct 1807 ms 5272 KB Output is correct
79 Correct 1874 ms 5176 KB Output is correct
80 Correct 1811 ms 5332 KB Output is correct
81 Correct 1811 ms 5376 KB Output is correct
82 Correct 1840 ms 5372 KB Output is correct
83 Correct 1801 ms 5408 KB Output is correct
84 Correct 1829 ms 5244 KB Output is correct