답안 #289678

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289678 2020-09-02T22:36:01 Z b00n0rp 벽 칠하기 (APIO20_paint) C++17
100 / 100
1129 ms 410028 KB
/*
Soln:
https://drive.google.com/file/d/1ZZIUOhvEl-sldF9eY8HSjTMnusHsbGsM/view
*/
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long double LD;
typedef long long ll;
// #define int ll
#define pb push_back
#define mp make_pair
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#define F first
#define S second
#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type,vector<type>,greater<type> >
#define WL(t) while(t --)
#define SZ(x) ((int)(x).size())
#define runtime() ((double)clock() / CLOCKS_PER_SEC)
#define inrange(i,a,b) ((i>=min(a,b)) && (i<=max(a,b)))

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const int MAXN = 100005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);
 
#ifdef int
const int INF=1e16;
#else
const int INF=1e9;
#endif
 
const int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;

int n,m,k;

vi a,c;
vvi b;


int dp[MAXN];

bool valid[MAXN];
vi gg[MAXN];
vi lol[MAXN];
int cnt[MAXN];

void checksegments(){
	REP(i,m){
		for(auto x:b[i]) gg[x].pb(i);
	}
	REP(i,n){
		for(auto x:gg[c[i]]) lol[i].pb({(x-i+n)%m});
	}
	REP(i,n){
		if(i >= m){
			for(auto x:lol[i-m]) cnt[x]--;
		}
		for(auto x:lol[i]){
			cnt[x]++;
			if(cnt[x] == m) valid[i+1-m] = 1;
		}

	}
}

int seg[MAXN*2];

void upd(int pos,int val){
	pos += n+1;
	seg[pos] = val;
	pos /= 2;
	while(pos){
		seg[pos] = min(seg[pos*2],seg[pos*2+1]);
		pos /= 2;
	}
}

int quer(int l,int r){
	l += n+1;
	r += n+1;
	int res = INF;
	while(l < r){
		if(l%2) remin(res,seg[l++]);
		if(r%2) remin(res,seg[--r]);
		l /= 2;
		r /= 2;
	}
	return res;
}

int minimumInstructions(int N, int M, int K, vi C, vi A, vvi B) {
	n = N;
	m = M;
	k = K;
	a = A;
	b = B;
	c = C;
	checksegments();
	dp[0] = 0;
	upd(0,0);
	FOR(i,1,n+1){
		dp[i] = INF;
		if(valid[i-m]) remin(dp[i],quer(i-m,i)+1);
		upd(i,dp[i]);
	}
	if(dp[n] == INF) return -1;
	return dp[n];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 4 ms 5012 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 3 ms 4992 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 4 ms 5024 KB Output is correct
13 Correct 4 ms 5120 KB Output is correct
14 Correct 4 ms 5120 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 4 ms 5120 KB Output is correct
17 Correct 4 ms 5120 KB Output is correct
18 Correct 4 ms 5120 KB Output is correct
19 Correct 4 ms 5120 KB Output is correct
20 Correct 4 ms 5120 KB Output is correct
21 Correct 4 ms 5120 KB Output is correct
22 Correct 31 ms 9344 KB Output is correct
23 Correct 31 ms 9464 KB Output is correct
24 Correct 31 ms 9344 KB Output is correct
25 Correct 8 ms 6144 KB Output is correct
26 Correct 8 ms 6068 KB Output is correct
27 Correct 9 ms 6144 KB Output is correct
28 Correct 9 ms 6272 KB Output is correct
29 Correct 8 ms 6144 KB Output is correct
30 Correct 8 ms 6144 KB Output is correct
31 Correct 18 ms 7168 KB Output is correct
32 Correct 18 ms 7168 KB Output is correct
33 Correct 18 ms 7168 KB Output is correct
34 Correct 18 ms 7168 KB Output is correct
35 Correct 19 ms 7168 KB Output is correct
36 Correct 18 ms 7160 KB Output is correct
37 Correct 44 ms 10616 KB Output is correct
38 Correct 44 ms 10744 KB Output is correct
39 Correct 42 ms 10624 KB Output is correct
40 Correct 26 ms 10104 KB Output is correct
41 Correct 17 ms 8192 KB Output is correct
42 Correct 29 ms 10488 KB Output is correct
43 Correct 20 ms 8696 KB Output is correct
44 Correct 18 ms 8320 KB Output is correct
45 Correct 28 ms 10624 KB Output is correct
46 Correct 77 ms 21112 KB Output is correct
47 Correct 54 ms 14136 KB Output is correct
48 Correct 64 ms 17912 KB Output is correct
49 Correct 73 ms 18084 KB Output is correct
50 Correct 95 ms 17784 KB Output is correct
51 Correct 88 ms 14840 KB Output is correct
52 Correct 41 ms 10616 KB Output is correct
53 Correct 39 ms 10616 KB Output is correct
54 Correct 31 ms 10624 KB Output is correct
55 Correct 40 ms 10616 KB Output is correct
56 Correct 43 ms 10616 KB Output is correct
57 Correct 28 ms 10624 KB Output is correct
58 Correct 131 ms 22520 KB Output is correct
59 Correct 93 ms 22520 KB Output is correct
60 Correct 114 ms 22520 KB Output is correct
61 Correct 92 ms 22520 KB Output is correct
62 Correct 92 ms 22520 KB Output is correct
63 Correct 90 ms 22520 KB Output is correct
64 Correct 92 ms 21496 KB Output is correct
65 Correct 95 ms 21432 KB Output is correct
66 Correct 92 ms 21496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 3 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 5012 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 5024 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 4 ms 5120 KB Output is correct
17 Correct 4 ms 5120 KB Output is correct
18 Correct 4 ms 5120 KB Output is correct
19 Correct 4 ms 5120 KB Output is correct
20 Correct 4 ms 5120 KB Output is correct
21 Correct 4 ms 5120 KB Output is correct
22 Correct 4 ms 5120 KB Output is correct
23 Correct 4 ms 5120 KB Output is correct
24 Correct 3 ms 4992 KB Output is correct
25 Correct 4 ms 4992 KB Output is correct
26 Correct 3 ms 4992 KB Output is correct
27 Correct 4 ms 4992 KB Output is correct
28 Correct 4 ms 5120 KB Output is correct
29 Correct 4 ms 5120 KB Output is correct
30 Correct 4 ms 5120 KB Output is correct
31 Correct 4 ms 5120 KB Output is correct
32 Correct 3 ms 5120 KB Output is correct
33 Correct 4 ms 5120 KB Output is correct
34 Correct 4 ms 5120 KB Output is correct
35 Correct 4 ms 5120 KB Output is correct
36 Correct 4 ms 5120 KB Output is correct
37 Correct 4 ms 5120 KB Output is correct
38 Correct 5 ms 5120 KB Output is correct
39 Correct 4 ms 4992 KB Output is correct
40 Correct 4 ms 5120 KB Output is correct
41 Correct 4 ms 5120 KB Output is correct
42 Correct 4 ms 5120 KB Output is correct
43 Correct 4 ms 5120 KB Output is correct
44 Correct 4 ms 4992 KB Output is correct
45 Correct 4 ms 5120 KB Output is correct
46 Correct 4 ms 5120 KB Output is correct
47 Correct 4 ms 5120 KB Output is correct
48 Correct 4 ms 5120 KB Output is correct
49 Correct 4 ms 5120 KB Output is correct
50 Correct 4 ms 5120 KB Output is correct
51 Correct 4 ms 5120 KB Output is correct
52 Correct 4 ms 5120 KB Output is correct
53 Correct 4 ms 5120 KB Output is correct
54 Correct 4 ms 5120 KB Output is correct
55 Correct 4 ms 5120 KB Output is correct
56 Correct 4 ms 5120 KB Output is correct
57 Correct 4 ms 5120 KB Output is correct
58 Correct 4 ms 5120 KB Output is correct
59 Correct 4 ms 5120 KB Output is correct
60 Correct 4 ms 5120 KB Output is correct
61 Correct 4 ms 5120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 3 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 5012 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 5024 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 4 ms 5120 KB Output is correct
17 Correct 4 ms 5120 KB Output is correct
18 Correct 4 ms 5120 KB Output is correct
19 Correct 4 ms 5120 KB Output is correct
20 Correct 4 ms 5120 KB Output is correct
21 Correct 4 ms 5120 KB Output is correct
22 Correct 4 ms 5120 KB Output is correct
23 Correct 4 ms 5120 KB Output is correct
24 Correct 31 ms 9344 KB Output is correct
25 Correct 31 ms 9464 KB Output is correct
26 Correct 31 ms 9344 KB Output is correct
27 Correct 3 ms 4992 KB Output is correct
28 Correct 4 ms 4992 KB Output is correct
29 Correct 3 ms 4992 KB Output is correct
30 Correct 4 ms 4992 KB Output is correct
31 Correct 4 ms 5120 KB Output is correct
32 Correct 4 ms 5120 KB Output is correct
33 Correct 4 ms 5120 KB Output is correct
34 Correct 4 ms 5120 KB Output is correct
35 Correct 3 ms 5120 KB Output is correct
36 Correct 4 ms 5120 KB Output is correct
37 Correct 4 ms 5120 KB Output is correct
38 Correct 4 ms 5120 KB Output is correct
39 Correct 4 ms 5120 KB Output is correct
40 Correct 4 ms 5120 KB Output is correct
41 Correct 5 ms 5120 KB Output is correct
42 Correct 4 ms 4992 KB Output is correct
43 Correct 4 ms 5120 KB Output is correct
44 Correct 4 ms 5120 KB Output is correct
45 Correct 4 ms 5120 KB Output is correct
46 Correct 4 ms 5120 KB Output is correct
47 Correct 4 ms 4992 KB Output is correct
48 Correct 4 ms 5120 KB Output is correct
49 Correct 4 ms 5120 KB Output is correct
50 Correct 4 ms 5120 KB Output is correct
51 Correct 4 ms 5120 KB Output is correct
52 Correct 4 ms 5120 KB Output is correct
53 Correct 4 ms 5120 KB Output is correct
54 Correct 4 ms 5120 KB Output is correct
55 Correct 4 ms 5120 KB Output is correct
56 Correct 4 ms 5120 KB Output is correct
57 Correct 4 ms 5120 KB Output is correct
58 Correct 4 ms 5120 KB Output is correct
59 Correct 4 ms 5120 KB Output is correct
60 Correct 4 ms 5120 KB Output is correct
61 Correct 4 ms 5120 KB Output is correct
62 Correct 4 ms 5120 KB Output is correct
63 Correct 4 ms 5120 KB Output is correct
64 Correct 4 ms 5120 KB Output is correct
65 Correct 4 ms 5376 KB Output is correct
66 Correct 4 ms 5120 KB Output is correct
67 Correct 6 ms 5248 KB Output is correct
68 Correct 4 ms 5248 KB Output is correct
69 Correct 4 ms 5248 KB Output is correct
70 Correct 6 ms 5376 KB Output is correct
71 Correct 6 ms 5376 KB Output is correct
72 Correct 6 ms 5248 KB Output is correct
73 Correct 5 ms 5248 KB Output is correct
74 Correct 8 ms 5352 KB Output is correct
75 Correct 5 ms 5280 KB Output is correct
76 Correct 35 ms 8184 KB Output is correct
77 Correct 28 ms 8568 KB Output is correct
78 Correct 42 ms 9104 KB Output is correct
79 Correct 5 ms 5632 KB Output is correct
80 Correct 7 ms 5632 KB Output is correct
81 Correct 6 ms 5632 KB Output is correct
82 Correct 5 ms 5632 KB Output is correct
83 Correct 6 ms 5632 KB Output is correct
84 Correct 8 ms 5376 KB Output is correct
85 Correct 7 ms 5376 KB Output is correct
86 Correct 7 ms 5376 KB Output is correct
87 Correct 7 ms 5376 KB Output is correct
88 Correct 7 ms 5376 KB Output is correct
89 Correct 8 ms 5376 KB Output is correct
90 Correct 51 ms 9468 KB Output is correct
91 Correct 49 ms 9336 KB Output is correct
92 Correct 51 ms 9464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 3 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 5012 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 5024 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 4 ms 5120 KB Output is correct
17 Correct 4 ms 5120 KB Output is correct
18 Correct 4 ms 5120 KB Output is correct
19 Correct 4 ms 5120 KB Output is correct
20 Correct 4 ms 5120 KB Output is correct
21 Correct 4 ms 5120 KB Output is correct
22 Correct 4 ms 5120 KB Output is correct
23 Correct 4 ms 5120 KB Output is correct
24 Correct 31 ms 9344 KB Output is correct
25 Correct 31 ms 9464 KB Output is correct
26 Correct 31 ms 9344 KB Output is correct
27 Correct 8 ms 6144 KB Output is correct
28 Correct 8 ms 6068 KB Output is correct
29 Correct 9 ms 6144 KB Output is correct
30 Correct 9 ms 6272 KB Output is correct
31 Correct 8 ms 6144 KB Output is correct
32 Correct 8 ms 6144 KB Output is correct
33 Correct 18 ms 7168 KB Output is correct
34 Correct 18 ms 7168 KB Output is correct
35 Correct 18 ms 7168 KB Output is correct
36 Correct 18 ms 7168 KB Output is correct
37 Correct 19 ms 7168 KB Output is correct
38 Correct 18 ms 7160 KB Output is correct
39 Correct 44 ms 10616 KB Output is correct
40 Correct 44 ms 10744 KB Output is correct
41 Correct 42 ms 10624 KB Output is correct
42 Correct 3 ms 4992 KB Output is correct
43 Correct 4 ms 4992 KB Output is correct
44 Correct 3 ms 4992 KB Output is correct
45 Correct 4 ms 4992 KB Output is correct
46 Correct 4 ms 5120 KB Output is correct
47 Correct 4 ms 5120 KB Output is correct
48 Correct 4 ms 5120 KB Output is correct
49 Correct 4 ms 5120 KB Output is correct
50 Correct 3 ms 5120 KB Output is correct
51 Correct 4 ms 5120 KB Output is correct
52 Correct 4 ms 5120 KB Output is correct
53 Correct 4 ms 5120 KB Output is correct
54 Correct 4 ms 5120 KB Output is correct
55 Correct 4 ms 5120 KB Output is correct
56 Correct 5 ms 5120 KB Output is correct
57 Correct 4 ms 4992 KB Output is correct
58 Correct 4 ms 5120 KB Output is correct
59 Correct 4 ms 5120 KB Output is correct
60 Correct 4 ms 5120 KB Output is correct
61 Correct 4 ms 5120 KB Output is correct
62 Correct 4 ms 4992 KB Output is correct
63 Correct 4 ms 5120 KB Output is correct
64 Correct 4 ms 5120 KB Output is correct
65 Correct 4 ms 5120 KB Output is correct
66 Correct 4 ms 5120 KB Output is correct
67 Correct 4 ms 5120 KB Output is correct
68 Correct 4 ms 5120 KB Output is correct
69 Correct 4 ms 5120 KB Output is correct
70 Correct 4 ms 5120 KB Output is correct
71 Correct 4 ms 5120 KB Output is correct
72 Correct 4 ms 5120 KB Output is correct
73 Correct 4 ms 5120 KB Output is correct
74 Correct 4 ms 5120 KB Output is correct
75 Correct 4 ms 5120 KB Output is correct
76 Correct 4 ms 5120 KB Output is correct
77 Correct 4 ms 5120 KB Output is correct
78 Correct 4 ms 5120 KB Output is correct
79 Correct 4 ms 5120 KB Output is correct
80 Correct 4 ms 5376 KB Output is correct
81 Correct 4 ms 5120 KB Output is correct
82 Correct 6 ms 5248 KB Output is correct
83 Correct 4 ms 5248 KB Output is correct
84 Correct 4 ms 5248 KB Output is correct
85 Correct 6 ms 5376 KB Output is correct
86 Correct 6 ms 5376 KB Output is correct
87 Correct 6 ms 5248 KB Output is correct
88 Correct 5 ms 5248 KB Output is correct
89 Correct 8 ms 5352 KB Output is correct
90 Correct 5 ms 5280 KB Output is correct
91 Correct 35 ms 8184 KB Output is correct
92 Correct 28 ms 8568 KB Output is correct
93 Correct 42 ms 9104 KB Output is correct
94 Correct 5 ms 5632 KB Output is correct
95 Correct 7 ms 5632 KB Output is correct
96 Correct 6 ms 5632 KB Output is correct
97 Correct 5 ms 5632 KB Output is correct
98 Correct 6 ms 5632 KB Output is correct
99 Correct 8 ms 5376 KB Output is correct
100 Correct 7 ms 5376 KB Output is correct
101 Correct 7 ms 5376 KB Output is correct
102 Correct 7 ms 5376 KB Output is correct
103 Correct 7 ms 5376 KB Output is correct
104 Correct 8 ms 5376 KB Output is correct
105 Correct 51 ms 9468 KB Output is correct
106 Correct 49 ms 9336 KB Output is correct
107 Correct 51 ms 9464 KB Output is correct
108 Correct 10 ms 6144 KB Output is correct
109 Correct 182 ms 63864 KB Output is correct
110 Correct 98 ms 30268 KB Output is correct
111 Correct 79 ms 28620 KB Output is correct
112 Correct 98 ms 36620 KB Output is correct
113 Correct 61 ms 20600 KB Output is correct
114 Correct 26 ms 7160 KB Output is correct
115 Correct 63 ms 7032 KB Output is correct
116 Correct 31 ms 7544 KB Output is correct
117 Correct 63 ms 7032 KB Output is correct
118 Correct 30 ms 7296 KB Output is correct
119 Correct 23 ms 6912 KB Output is correct
120 Correct 34 ms 8440 KB Output is correct
121 Correct 14 ms 6272 KB Output is correct
122 Correct 37 ms 8704 KB Output is correct
123 Correct 12 ms 6144 KB Output is correct
124 Correct 52 ms 9420 KB Output is correct
125 Correct 16 ms 6648 KB Output is correct
126 Correct 15 ms 6656 KB Output is correct
127 Correct 20 ms 7040 KB Output is correct
128 Correct 32 ms 6392 KB Output is correct
129 Correct 15 ms 6528 KB Output is correct
130 Correct 9 ms 6144 KB Output is correct
131 Correct 255 ms 86092 KB Output is correct
132 Correct 177 ms 46072 KB Output is correct
133 Correct 150 ms 46072 KB Output is correct
134 Correct 138 ms 46072 KB Output is correct
135 Correct 129 ms 42104 KB Output is correct
136 Correct 37 ms 7932 KB Output is correct
137 Correct 35 ms 7908 KB Output is correct
138 Correct 35 ms 7936 KB Output is correct
139 Correct 34 ms 7920 KB Output is correct
140 Correct 37 ms 7928 KB Output is correct
141 Correct 80 ms 7928 KB Output is correct
142 Correct 108 ms 10616 KB Output is correct
143 Correct 21 ms 7040 KB Output is correct
144 Correct 65 ms 10620 KB Output is correct
145 Correct 19 ms 7040 KB Output is correct
146 Correct 70 ms 10616 KB Output is correct
147 Correct 21 ms 7040 KB Output is correct
148 Correct 20 ms 7424 KB Output is correct
149 Correct 23 ms 7288 KB Output is correct
150 Correct 21 ms 7152 KB Output is correct
151 Correct 20 ms 7168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 3 ms 4992 KB Output is correct
4 Correct 3 ms 4992 KB Output is correct
5 Correct 3 ms 4992 KB Output is correct
6 Correct 3 ms 4992 KB Output is correct
7 Correct 3 ms 4992 KB Output is correct
8 Correct 3 ms 4992 KB Output is correct
9 Correct 3 ms 4992 KB Output is correct
10 Correct 4 ms 5012 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 3 ms 4992 KB Output is correct
13 Correct 3 ms 4992 KB Output is correct
14 Correct 4 ms 5024 KB Output is correct
15 Correct 4 ms 5120 KB Output is correct
16 Correct 4 ms 5120 KB Output is correct
17 Correct 4 ms 5120 KB Output is correct
18 Correct 4 ms 5120 KB Output is correct
19 Correct 4 ms 5120 KB Output is correct
20 Correct 4 ms 5120 KB Output is correct
21 Correct 4 ms 5120 KB Output is correct
22 Correct 4 ms 5120 KB Output is correct
23 Correct 4 ms 5120 KB Output is correct
24 Correct 31 ms 9344 KB Output is correct
25 Correct 31 ms 9464 KB Output is correct
26 Correct 31 ms 9344 KB Output is correct
27 Correct 8 ms 6144 KB Output is correct
28 Correct 8 ms 6068 KB Output is correct
29 Correct 9 ms 6144 KB Output is correct
30 Correct 9 ms 6272 KB Output is correct
31 Correct 8 ms 6144 KB Output is correct
32 Correct 8 ms 6144 KB Output is correct
33 Correct 18 ms 7168 KB Output is correct
34 Correct 18 ms 7168 KB Output is correct
35 Correct 18 ms 7168 KB Output is correct
36 Correct 18 ms 7168 KB Output is correct
37 Correct 19 ms 7168 KB Output is correct
38 Correct 18 ms 7160 KB Output is correct
39 Correct 44 ms 10616 KB Output is correct
40 Correct 44 ms 10744 KB Output is correct
41 Correct 42 ms 10624 KB Output is correct
42 Correct 26 ms 10104 KB Output is correct
43 Correct 17 ms 8192 KB Output is correct
44 Correct 29 ms 10488 KB Output is correct
45 Correct 20 ms 8696 KB Output is correct
46 Correct 18 ms 8320 KB Output is correct
47 Correct 28 ms 10624 KB Output is correct
48 Correct 77 ms 21112 KB Output is correct
49 Correct 54 ms 14136 KB Output is correct
50 Correct 64 ms 17912 KB Output is correct
51 Correct 73 ms 18084 KB Output is correct
52 Correct 95 ms 17784 KB Output is correct
53 Correct 88 ms 14840 KB Output is correct
54 Correct 41 ms 10616 KB Output is correct
55 Correct 39 ms 10616 KB Output is correct
56 Correct 31 ms 10624 KB Output is correct
57 Correct 40 ms 10616 KB Output is correct
58 Correct 43 ms 10616 KB Output is correct
59 Correct 28 ms 10624 KB Output is correct
60 Correct 131 ms 22520 KB Output is correct
61 Correct 93 ms 22520 KB Output is correct
62 Correct 114 ms 22520 KB Output is correct
63 Correct 92 ms 22520 KB Output is correct
64 Correct 92 ms 22520 KB Output is correct
65 Correct 90 ms 22520 KB Output is correct
66 Correct 92 ms 21496 KB Output is correct
67 Correct 95 ms 21432 KB Output is correct
68 Correct 92 ms 21496 KB Output is correct
69 Correct 3 ms 4992 KB Output is correct
70 Correct 4 ms 4992 KB Output is correct
71 Correct 3 ms 4992 KB Output is correct
72 Correct 4 ms 4992 KB Output is correct
73 Correct 4 ms 5120 KB Output is correct
74 Correct 4 ms 5120 KB Output is correct
75 Correct 4 ms 5120 KB Output is correct
76 Correct 4 ms 5120 KB Output is correct
77 Correct 3 ms 5120 KB Output is correct
78 Correct 4 ms 5120 KB Output is correct
79 Correct 4 ms 5120 KB Output is correct
80 Correct 4 ms 5120 KB Output is correct
81 Correct 4 ms 5120 KB Output is correct
82 Correct 4 ms 5120 KB Output is correct
83 Correct 5 ms 5120 KB Output is correct
84 Correct 4 ms 4992 KB Output is correct
85 Correct 4 ms 5120 KB Output is correct
86 Correct 4 ms 5120 KB Output is correct
87 Correct 4 ms 5120 KB Output is correct
88 Correct 4 ms 5120 KB Output is correct
89 Correct 4 ms 4992 KB Output is correct
90 Correct 4 ms 5120 KB Output is correct
91 Correct 4 ms 5120 KB Output is correct
92 Correct 4 ms 5120 KB Output is correct
93 Correct 4 ms 5120 KB Output is correct
94 Correct 4 ms 5120 KB Output is correct
95 Correct 4 ms 5120 KB Output is correct
96 Correct 4 ms 5120 KB Output is correct
97 Correct 4 ms 5120 KB Output is correct
98 Correct 4 ms 5120 KB Output is correct
99 Correct 4 ms 5120 KB Output is correct
100 Correct 4 ms 5120 KB Output is correct
101 Correct 4 ms 5120 KB Output is correct
102 Correct 4 ms 5120 KB Output is correct
103 Correct 4 ms 5120 KB Output is correct
104 Correct 4 ms 5120 KB Output is correct
105 Correct 4 ms 5120 KB Output is correct
106 Correct 4 ms 5120 KB Output is correct
107 Correct 4 ms 5376 KB Output is correct
108 Correct 4 ms 5120 KB Output is correct
109 Correct 6 ms 5248 KB Output is correct
110 Correct 4 ms 5248 KB Output is correct
111 Correct 4 ms 5248 KB Output is correct
112 Correct 6 ms 5376 KB Output is correct
113 Correct 6 ms 5376 KB Output is correct
114 Correct 6 ms 5248 KB Output is correct
115 Correct 5 ms 5248 KB Output is correct
116 Correct 8 ms 5352 KB Output is correct
117 Correct 5 ms 5280 KB Output is correct
118 Correct 35 ms 8184 KB Output is correct
119 Correct 28 ms 8568 KB Output is correct
120 Correct 42 ms 9104 KB Output is correct
121 Correct 5 ms 5632 KB Output is correct
122 Correct 7 ms 5632 KB Output is correct
123 Correct 6 ms 5632 KB Output is correct
124 Correct 5 ms 5632 KB Output is correct
125 Correct 6 ms 5632 KB Output is correct
126 Correct 8 ms 5376 KB Output is correct
127 Correct 7 ms 5376 KB Output is correct
128 Correct 7 ms 5376 KB Output is correct
129 Correct 7 ms 5376 KB Output is correct
130 Correct 7 ms 5376 KB Output is correct
131 Correct 8 ms 5376 KB Output is correct
132 Correct 51 ms 9468 KB Output is correct
133 Correct 49 ms 9336 KB Output is correct
134 Correct 51 ms 9464 KB Output is correct
135 Correct 10 ms 6144 KB Output is correct
136 Correct 182 ms 63864 KB Output is correct
137 Correct 98 ms 30268 KB Output is correct
138 Correct 79 ms 28620 KB Output is correct
139 Correct 98 ms 36620 KB Output is correct
140 Correct 61 ms 20600 KB Output is correct
141 Correct 26 ms 7160 KB Output is correct
142 Correct 63 ms 7032 KB Output is correct
143 Correct 31 ms 7544 KB Output is correct
144 Correct 63 ms 7032 KB Output is correct
145 Correct 30 ms 7296 KB Output is correct
146 Correct 23 ms 6912 KB Output is correct
147 Correct 34 ms 8440 KB Output is correct
148 Correct 14 ms 6272 KB Output is correct
149 Correct 37 ms 8704 KB Output is correct
150 Correct 12 ms 6144 KB Output is correct
151 Correct 52 ms 9420 KB Output is correct
152 Correct 16 ms 6648 KB Output is correct
153 Correct 15 ms 6656 KB Output is correct
154 Correct 20 ms 7040 KB Output is correct
155 Correct 32 ms 6392 KB Output is correct
156 Correct 15 ms 6528 KB Output is correct
157 Correct 9 ms 6144 KB Output is correct
158 Correct 255 ms 86092 KB Output is correct
159 Correct 177 ms 46072 KB Output is correct
160 Correct 150 ms 46072 KB Output is correct
161 Correct 138 ms 46072 KB Output is correct
162 Correct 129 ms 42104 KB Output is correct
163 Correct 37 ms 7932 KB Output is correct
164 Correct 35 ms 7908 KB Output is correct
165 Correct 35 ms 7936 KB Output is correct
166 Correct 34 ms 7920 KB Output is correct
167 Correct 37 ms 7928 KB Output is correct
168 Correct 80 ms 7928 KB Output is correct
169 Correct 108 ms 10616 KB Output is correct
170 Correct 21 ms 7040 KB Output is correct
171 Correct 65 ms 10620 KB Output is correct
172 Correct 19 ms 7040 KB Output is correct
173 Correct 70 ms 10616 KB Output is correct
174 Correct 21 ms 7040 KB Output is correct
175 Correct 20 ms 7424 KB Output is correct
176 Correct 23 ms 7288 KB Output is correct
177 Correct 21 ms 7152 KB Output is correct
178 Correct 20 ms 7168 KB Output is correct
179 Correct 22 ms 8448 KB Output is correct
180 Correct 432 ms 111436 KB Output is correct
181 Correct 515 ms 158852 KB Output is correct
182 Correct 666 ms 207612 KB Output is correct
183 Correct 346 ms 105336 KB Output is correct
184 Correct 265 ms 70136 KB Output is correct
185 Correct 61 ms 11384 KB Output is correct
186 Correct 72 ms 14164 KB Output is correct
187 Correct 82 ms 12664 KB Output is correct
188 Correct 77 ms 12536 KB Output is correct
189 Correct 114 ms 13048 KB Output is correct
190 Correct 73 ms 14248 KB Output is correct
191 Correct 70 ms 14072 KB Output is correct
192 Correct 62 ms 10872 KB Output is correct
193 Correct 54 ms 10872 KB Output is correct
194 Correct 33 ms 10616 KB Output is correct
195 Correct 1129 ms 410028 KB Output is correct
196 Correct 751 ms 209544 KB Output is correct
197 Correct 656 ms 209588 KB Output is correct
198 Correct 607 ms 209528 KB Output is correct
199 Correct 570 ms 189688 KB Output is correct
200 Correct 162 ms 22520 KB Output is correct
201 Correct 143 ms 22520 KB Output is correct
202 Correct 124 ms 22520 KB Output is correct
203 Correct 131 ms 22520 KB Output is correct
204 Correct 124 ms 22520 KB Output is correct
205 Correct 126 ms 22556 KB Output is correct
206 Correct 129 ms 21112 KB Output is correct
207 Correct 105 ms 21496 KB Output is correct
208 Correct 122 ms 21112 KB Output is correct
209 Correct 111 ms 21668 KB Output is correct
210 Correct 113 ms 21244 KB Output is correct
211 Correct 98 ms 21496 KB Output is correct
212 Correct 101 ms 22456 KB Output is correct
213 Correct 100 ms 18064 KB Output is correct
214 Correct 101 ms 17376 KB Output is correct
215 Correct 101 ms 17144 KB Output is correct