#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 500005;
struct edge{
int s, e, x;
};
int n, m;
vector<int> gph[MAXN];
int par[20][MAXN], dep[MAXN];
int lca(int x, int y){
if(dep[x] > dep[y]) swap(x, y);
int dx = dep[y] - dep[x];
for(int i = 0; dx; i++){
if(dx & 1) y = par[i][y];
dx >>= 1;
}
if(x == y) return x;
for(int i = 17; i >= 0; i--){
if(par[i][x] != par[i][y]){
x = par[i][x];
y = par[i][y];
}
}
return par[0][x];
}
struct node{
int lmax, rmax, opt, len;
node():
lmax(-1e9), rmax(-1e9), opt(-1e9), len(0) {}
node(int x):
lmax(x), rmax(x), opt(-1e9), len(1) {}
node(int a, int b, int c, int e):
lmax(a), rmax(b), opt(c), len(e) {}
node reverse(){
return node(rmax, lmax, opt, len);
}
node operator+(const node &n)const{
return node(
max(lmax - n.len, n.lmax),
max(rmax, n.rmax - len),
max({opt, n.opt, lmax + n.rmax - 1}),
len + n.len);
};
};
vector<int> ord;
int din[MAXN], dout[MAXN], piv;
int far[MAXN], diam[MAXN], pfar[MAXN], pdiam[MAXN];
int f[20][MAXN];
node g[20][MAXN];
vector<pi> fars[MAXN];
vector<pi> subDiams[MAXN];
int fPathMax(int x, int v){
int ans = -1e9;
for(int i = 0; v; i++){
if(v & 1){
ans = max(ans, f[i][x]);
x = par[i][x];
}
v >>= 1;
}
return ans;
}
node gPathSum(int x, int v){
node gs;
for(int i = 0; v; i++){
if(v & 1){
gs = gs + g[i][x];
x = par[i][x];
}
v >>= 1;
}
return gs;
}
bool in(int u, int v){
return din[u] <= din[v] && dout[v] <= dout[u];
}
void dfs(int x, int p = -1){
ord.push_back(x);
din[x] = ++piv;
for(auto &y : gph[x]){
if(y == p) continue;
par[0][y] = x;
dep[y] = dep[x] + 1;
dfs(y, x);
}
dout[x] = piv;
}
bool vis[MAXN];
pi dfsl(int x, int p = -1){
pi ret(0, x);
for(auto &y : gph[x]){
if(y == p || vis[y]) continue;
auto ans = dfsl(y, x);
ans.first++;
ret = max(ret, ans);
}
return ret;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
vector<edge> qry;
for(int i = 0; i < m; i++){
int s, e, x; cin >> s >> e >> x;
if(x == 1){
gph[s].push_back(e);
gph[e].push_back(s);
}
else{
qry.push_back({s, e, x});
}
}
dfs(0);
for(int i = 1; i < 20; i++){
for(int j = 0; j < n; j++){
par[i][j] = par[i-1][par[i-1][j]];
}
}
{
reverse(all(ord));
for(auto &i : ord){
for(auto &j : gph[i]){
if(j == par[0][i]) continue;
far[i] = max(far[i], far[j] + 1);
diam[i] = max({diam[i], diam[j], far[j] + 1});
fars[i].emplace_back(far[j], j);
}
sort(all(fars[i]));
reverse(all(fars[i]));
if(sz(fars[i]) >= 2) diam[i] = max(diam[i], (int)fars[i][0].first + (int)fars[i][1].first + 2);
}
reverse(all(ord));
for(auto &i : ord){
if(i == 0) continue;
for(auto &j : fars[par[0][i]]){
if(j.second == i) continue;
pfar[i] = j.first + 1;
break;
}
fars[i].emplace_back(pfar[i], par[0][i]);
sort(all(fars[i]));
reverse(all(fars[i]));
}
for(auto &i : ord){
if(i == 0) continue;
for(auto &[d, v] : subDiams[par[0][i]]){
if(v == i) continue;
pdiam[i] = max(pdiam[i], (int)d);
break;
}
{
int new_diam = 0;
int cnt = 0;
for(auto &[d, v] : fars[par[0][i]]){
if(v == i) continue;
new_diam += d + 1;
cnt += 1;
if(cnt == 2) break;
}
pdiam[i] = max(pdiam[i], new_diam);
}
for(auto &j : gph[i]){
if(j == par[0][i]) subDiams[i].emplace_back(pdiam[i], j);
else subDiams[i].emplace_back(diam[j], j);
}
sort(all(subDiams[i]));
reverse(all(subDiams[i]));
}
for(int i = 0; i < n; i++){
if(dep[i] >= 2){
int cnt = 0;
int gi = 0;
for(auto &[d, v] : fars[par[0][i]]){
if(v == i || v == par[1][i]) continue;
gi = max(gi, (int)d + 1);
f[0][i] += d + 1;
cnt++;
if(cnt == 2) break;
}
for(auto &[d, v] : subDiams[par[0][i]]){
if(v == i || v == par[1][i]) continue;
f[0][i] = max(f[0][i], (int)d);
break;
}
g[0][i] = node(gi);
}
}
for(int i = 1; i < 20; i++){
for(int j = 0; j < n; j++){
f[i][j] = max(f[i-1][j], f[i-1][par[i-1][j]]);
g[i][j] = g[i-1][j] + g[i-1][par[i-1][j]];
}
}
}
int ans = 2 * n - 2 - diam[0];
for(auto &x : qry){
int l = lca(x.s, x.e);
int plen = dep[x.s] + dep[x.e] - 2 * dep[l] + 1;
int maxPath = -1e9;
if(dep[x.s] >= dep[l] + 2){
maxPath = max(maxPath, fPathMax(x.s, dep[x.s] - dep[l] - 1) - 3 + plen);
}
if(dep[x.e] >= dep[l] + 2){
maxPath = max(maxPath, fPathMax(x.e, dep[x.e] - dep[l] - 1) - 3 + plen);
}
if(l != x.s){
maxPath = max(maxPath, diam[x.s] - 3 + plen);
}
if(l != x.e){
maxPath = max(maxPath, diam[x.e] - 3 + plen);
}
{
int new_diam = 0;
int cnt = 0;
// passes through l
for(auto &[d, v] : fars[l]){
if((in(v, x.s) || in(v, x.e)) && v != par[0][l]) continue;
new_diam += d + 1;
cnt += 1;
if(cnt == 2) break;
}
for(auto &[d, v] : subDiams[l]){
if((in(v, x.s) || in(v, x.e)) && v != par[0][l]) continue;
new_diam = max(new_diam, (int)d);
break;
}
maxPath = max(maxPath, new_diam - 3 + plen);
}
// TODO: qn.
node valup, valdown;
if(x.s != l) valup = valup + node(far[x.s]);
if(x.e != l) valdown = valdown + node(far[x.e]);
if(dep[x.s] >= dep[l] + 2){
valup = valup + gPathSum(x.s, dep[x.s] - dep[l] - 1);
}
if(dep[x.e] >= dep[l] + 2){
valdown = valdown + gPathSum(x.e, dep[x.e] - dep[l] - 1);
}
{
int dist = 0;
for(auto &[d, v] : fars[l]){
if((in(v, x.s) || in(v, x.e)) && v != par[0][l]) continue;
dist = max(dist, (int)d + 1);
break;
}
valup = valup + node(dist);
}
node val = valup + valdown.reverse();
maxPath = max(maxPath, val.opt + val.len - 1);
ans = min(ans, 2 * n - 4 + x.x - maxPath);
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
16 |
Correct |
80 ms |
192428 KB |
Output is correct |
17 |
Correct |
82 ms |
192384 KB |
Output is correct |
18 |
Correct |
90 ms |
192404 KB |
Output is correct |
19 |
Correct |
84 ms |
192372 KB |
Output is correct |
20 |
Correct |
94 ms |
192324 KB |
Output is correct |
21 |
Correct |
85 ms |
192360 KB |
Output is correct |
22 |
Correct |
85 ms |
192412 KB |
Output is correct |
23 |
Correct |
82 ms |
192324 KB |
Output is correct |
24 |
Correct |
83 ms |
192332 KB |
Output is correct |
25 |
Correct |
83 ms |
192448 KB |
Output is correct |
26 |
Correct |
90 ms |
192636 KB |
Output is correct |
27 |
Correct |
83 ms |
192324 KB |
Output is correct |
28 |
Correct |
86 ms |
192336 KB |
Output is correct |
29 |
Correct |
81 ms |
192376 KB |
Output is correct |
30 |
Correct |
82 ms |
192324 KB |
Output is correct |
31 |
Correct |
80 ms |
192424 KB |
Output is correct |
32 |
Correct |
84 ms |
192336 KB |
Output is correct |
33 |
Correct |
90 ms |
192400 KB |
Output is correct |
34 |
Correct |
82 ms |
192328 KB |
Output is correct |
35 |
Correct |
81 ms |
192328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
88 ms |
194120 KB |
Output is correct |
2 |
Correct |
96 ms |
194248 KB |
Output is correct |
3 |
Correct |
89 ms |
194004 KB |
Output is correct |
4 |
Correct |
88 ms |
194012 KB |
Output is correct |
5 |
Correct |
88 ms |
193908 KB |
Output is correct |
6 |
Correct |
88 ms |
193956 KB |
Output is correct |
7 |
Correct |
93 ms |
194272 KB |
Output is correct |
8 |
Correct |
93 ms |
194048 KB |
Output is correct |
9 |
Correct |
89 ms |
194140 KB |
Output is correct |
10 |
Correct |
89 ms |
193940 KB |
Output is correct |
11 |
Correct |
87 ms |
193980 KB |
Output is correct |
12 |
Correct |
91 ms |
193860 KB |
Output is correct |
13 |
Correct |
89 ms |
193988 KB |
Output is correct |
14 |
Correct |
90 ms |
193968 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
16 |
Correct |
80 ms |
192428 KB |
Output is correct |
17 |
Correct |
82 ms |
192384 KB |
Output is correct |
18 |
Correct |
90 ms |
192404 KB |
Output is correct |
19 |
Correct |
84 ms |
192372 KB |
Output is correct |
20 |
Correct |
94 ms |
192324 KB |
Output is correct |
21 |
Correct |
85 ms |
192360 KB |
Output is correct |
22 |
Correct |
85 ms |
192412 KB |
Output is correct |
23 |
Correct |
82 ms |
192324 KB |
Output is correct |
24 |
Correct |
83 ms |
192332 KB |
Output is correct |
25 |
Correct |
83 ms |
192448 KB |
Output is correct |
26 |
Correct |
90 ms |
192636 KB |
Output is correct |
27 |
Correct |
83 ms |
192324 KB |
Output is correct |
28 |
Correct |
86 ms |
192336 KB |
Output is correct |
29 |
Correct |
81 ms |
192376 KB |
Output is correct |
30 |
Correct |
82 ms |
192324 KB |
Output is correct |
31 |
Correct |
80 ms |
192424 KB |
Output is correct |
32 |
Correct |
84 ms |
192336 KB |
Output is correct |
33 |
Correct |
90 ms |
192400 KB |
Output is correct |
34 |
Correct |
82 ms |
192328 KB |
Output is correct |
35 |
Correct |
81 ms |
192328 KB |
Output is correct |
36 |
Correct |
81 ms |
192368 KB |
Output is correct |
37 |
Correct |
81 ms |
192456 KB |
Output is correct |
38 |
Correct |
89 ms |
192396 KB |
Output is correct |
39 |
Correct |
109 ms |
192448 KB |
Output is correct |
40 |
Correct |
81 ms |
192452 KB |
Output is correct |
41 |
Correct |
80 ms |
192464 KB |
Output is correct |
42 |
Correct |
81 ms |
192392 KB |
Output is correct |
43 |
Correct |
81 ms |
192372 KB |
Output is correct |
44 |
Correct |
88 ms |
192384 KB |
Output is correct |
45 |
Correct |
80 ms |
192468 KB |
Output is correct |
46 |
Correct |
81 ms |
192428 KB |
Output is correct |
47 |
Correct |
84 ms |
192456 KB |
Output is correct |
48 |
Correct |
81 ms |
192456 KB |
Output is correct |
49 |
Correct |
81 ms |
192456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
16 |
Correct |
80 ms |
192428 KB |
Output is correct |
17 |
Correct |
82 ms |
192384 KB |
Output is correct |
18 |
Correct |
90 ms |
192404 KB |
Output is correct |
19 |
Correct |
84 ms |
192372 KB |
Output is correct |
20 |
Correct |
94 ms |
192324 KB |
Output is correct |
21 |
Correct |
85 ms |
192360 KB |
Output is correct |
22 |
Correct |
85 ms |
192412 KB |
Output is correct |
23 |
Correct |
82 ms |
192324 KB |
Output is correct |
24 |
Correct |
83 ms |
192332 KB |
Output is correct |
25 |
Correct |
83 ms |
192448 KB |
Output is correct |
26 |
Correct |
90 ms |
192636 KB |
Output is correct |
27 |
Correct |
83 ms |
192324 KB |
Output is correct |
28 |
Correct |
86 ms |
192336 KB |
Output is correct |
29 |
Correct |
81 ms |
192376 KB |
Output is correct |
30 |
Correct |
82 ms |
192324 KB |
Output is correct |
31 |
Correct |
80 ms |
192424 KB |
Output is correct |
32 |
Correct |
84 ms |
192336 KB |
Output is correct |
33 |
Correct |
90 ms |
192400 KB |
Output is correct |
34 |
Correct |
82 ms |
192328 KB |
Output is correct |
35 |
Correct |
81 ms |
192328 KB |
Output is correct |
36 |
Correct |
81 ms |
192368 KB |
Output is correct |
37 |
Correct |
81 ms |
192456 KB |
Output is correct |
38 |
Correct |
89 ms |
192396 KB |
Output is correct |
39 |
Correct |
109 ms |
192448 KB |
Output is correct |
40 |
Correct |
81 ms |
192452 KB |
Output is correct |
41 |
Correct |
80 ms |
192464 KB |
Output is correct |
42 |
Correct |
81 ms |
192392 KB |
Output is correct |
43 |
Correct |
81 ms |
192372 KB |
Output is correct |
44 |
Correct |
88 ms |
192384 KB |
Output is correct |
45 |
Correct |
80 ms |
192468 KB |
Output is correct |
46 |
Correct |
81 ms |
192428 KB |
Output is correct |
47 |
Correct |
84 ms |
192456 KB |
Output is correct |
48 |
Correct |
81 ms |
192456 KB |
Output is correct |
49 |
Correct |
81 ms |
192456 KB |
Output is correct |
50 |
Correct |
81 ms |
192536 KB |
Output is correct |
51 |
Correct |
81 ms |
192580 KB |
Output is correct |
52 |
Correct |
88 ms |
192556 KB |
Output is correct |
53 |
Correct |
83 ms |
192580 KB |
Output is correct |
54 |
Correct |
81 ms |
192540 KB |
Output is correct |
55 |
Correct |
91 ms |
192524 KB |
Output is correct |
56 |
Correct |
81 ms |
192608 KB |
Output is correct |
57 |
Correct |
88 ms |
192616 KB |
Output is correct |
58 |
Correct |
82 ms |
192496 KB |
Output is correct |
59 |
Correct |
81 ms |
192580 KB |
Output is correct |
60 |
Correct |
90 ms |
192600 KB |
Output is correct |
61 |
Correct |
84 ms |
192548 KB |
Output is correct |
62 |
Correct |
82 ms |
192580 KB |
Output is correct |
63 |
Correct |
81 ms |
192512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
16 |
Correct |
80 ms |
192428 KB |
Output is correct |
17 |
Correct |
82 ms |
192384 KB |
Output is correct |
18 |
Correct |
90 ms |
192404 KB |
Output is correct |
19 |
Correct |
84 ms |
192372 KB |
Output is correct |
20 |
Correct |
94 ms |
192324 KB |
Output is correct |
21 |
Correct |
85 ms |
192360 KB |
Output is correct |
22 |
Correct |
85 ms |
192412 KB |
Output is correct |
23 |
Correct |
82 ms |
192324 KB |
Output is correct |
24 |
Correct |
83 ms |
192332 KB |
Output is correct |
25 |
Correct |
83 ms |
192448 KB |
Output is correct |
26 |
Correct |
90 ms |
192636 KB |
Output is correct |
27 |
Correct |
83 ms |
192324 KB |
Output is correct |
28 |
Correct |
86 ms |
192336 KB |
Output is correct |
29 |
Correct |
81 ms |
192376 KB |
Output is correct |
30 |
Correct |
82 ms |
192324 KB |
Output is correct |
31 |
Correct |
80 ms |
192424 KB |
Output is correct |
32 |
Correct |
84 ms |
192336 KB |
Output is correct |
33 |
Correct |
90 ms |
192400 KB |
Output is correct |
34 |
Correct |
82 ms |
192328 KB |
Output is correct |
35 |
Correct |
81 ms |
192328 KB |
Output is correct |
36 |
Correct |
88 ms |
194120 KB |
Output is correct |
37 |
Correct |
96 ms |
194248 KB |
Output is correct |
38 |
Correct |
89 ms |
194004 KB |
Output is correct |
39 |
Correct |
88 ms |
194012 KB |
Output is correct |
40 |
Correct |
88 ms |
193908 KB |
Output is correct |
41 |
Correct |
88 ms |
193956 KB |
Output is correct |
42 |
Correct |
93 ms |
194272 KB |
Output is correct |
43 |
Correct |
93 ms |
194048 KB |
Output is correct |
44 |
Correct |
89 ms |
194140 KB |
Output is correct |
45 |
Correct |
89 ms |
193940 KB |
Output is correct |
46 |
Correct |
87 ms |
193980 KB |
Output is correct |
47 |
Correct |
91 ms |
193860 KB |
Output is correct |
48 |
Correct |
89 ms |
193988 KB |
Output is correct |
49 |
Correct |
90 ms |
193968 KB |
Output is correct |
50 |
Correct |
81 ms |
192368 KB |
Output is correct |
51 |
Correct |
81 ms |
192456 KB |
Output is correct |
52 |
Correct |
89 ms |
192396 KB |
Output is correct |
53 |
Correct |
109 ms |
192448 KB |
Output is correct |
54 |
Correct |
81 ms |
192452 KB |
Output is correct |
55 |
Correct |
80 ms |
192464 KB |
Output is correct |
56 |
Correct |
81 ms |
192392 KB |
Output is correct |
57 |
Correct |
81 ms |
192372 KB |
Output is correct |
58 |
Correct |
88 ms |
192384 KB |
Output is correct |
59 |
Correct |
80 ms |
192468 KB |
Output is correct |
60 |
Correct |
81 ms |
192428 KB |
Output is correct |
61 |
Correct |
84 ms |
192456 KB |
Output is correct |
62 |
Correct |
81 ms |
192456 KB |
Output is correct |
63 |
Correct |
81 ms |
192456 KB |
Output is correct |
64 |
Correct |
81 ms |
192536 KB |
Output is correct |
65 |
Correct |
81 ms |
192580 KB |
Output is correct |
66 |
Correct |
88 ms |
192556 KB |
Output is correct |
67 |
Correct |
83 ms |
192580 KB |
Output is correct |
68 |
Correct |
81 ms |
192540 KB |
Output is correct |
69 |
Correct |
91 ms |
192524 KB |
Output is correct |
70 |
Correct |
81 ms |
192608 KB |
Output is correct |
71 |
Correct |
88 ms |
192616 KB |
Output is correct |
72 |
Correct |
82 ms |
192496 KB |
Output is correct |
73 |
Correct |
81 ms |
192580 KB |
Output is correct |
74 |
Correct |
90 ms |
192600 KB |
Output is correct |
75 |
Correct |
84 ms |
192548 KB |
Output is correct |
76 |
Correct |
82 ms |
192580 KB |
Output is correct |
77 |
Correct |
81 ms |
192512 KB |
Output is correct |
78 |
Correct |
86 ms |
193952 KB |
Output is correct |
79 |
Correct |
88 ms |
194008 KB |
Output is correct |
80 |
Correct |
89 ms |
193988 KB |
Output is correct |
81 |
Correct |
93 ms |
193968 KB |
Output is correct |
82 |
Correct |
89 ms |
193988 KB |
Output is correct |
83 |
Correct |
87 ms |
193984 KB |
Output is correct |
84 |
Correct |
88 ms |
194052 KB |
Output is correct |
85 |
Correct |
91 ms |
194108 KB |
Output is correct |
86 |
Correct |
89 ms |
194116 KB |
Output is correct |
87 |
Correct |
88 ms |
193956 KB |
Output is correct |
88 |
Correct |
87 ms |
193988 KB |
Output is correct |
89 |
Correct |
88 ms |
193944 KB |
Output is correct |
90 |
Correct |
84 ms |
193884 KB |
Output is correct |
91 |
Correct |
90 ms |
193908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
16 |
Correct |
80 ms |
192428 KB |
Output is correct |
17 |
Correct |
82 ms |
192384 KB |
Output is correct |
18 |
Correct |
90 ms |
192404 KB |
Output is correct |
19 |
Correct |
84 ms |
192372 KB |
Output is correct |
20 |
Correct |
94 ms |
192324 KB |
Output is correct |
21 |
Correct |
85 ms |
192360 KB |
Output is correct |
22 |
Correct |
85 ms |
192412 KB |
Output is correct |
23 |
Correct |
82 ms |
192324 KB |
Output is correct |
24 |
Correct |
83 ms |
192332 KB |
Output is correct |
25 |
Correct |
83 ms |
192448 KB |
Output is correct |
26 |
Correct |
90 ms |
192636 KB |
Output is correct |
27 |
Correct |
83 ms |
192324 KB |
Output is correct |
28 |
Correct |
86 ms |
192336 KB |
Output is correct |
29 |
Correct |
81 ms |
192376 KB |
Output is correct |
30 |
Correct |
82 ms |
192324 KB |
Output is correct |
31 |
Correct |
80 ms |
192424 KB |
Output is correct |
32 |
Correct |
84 ms |
192336 KB |
Output is correct |
33 |
Correct |
90 ms |
192400 KB |
Output is correct |
34 |
Correct |
82 ms |
192328 KB |
Output is correct |
35 |
Correct |
81 ms |
192328 KB |
Output is correct |
36 |
Correct |
88 ms |
194120 KB |
Output is correct |
37 |
Correct |
96 ms |
194248 KB |
Output is correct |
38 |
Correct |
89 ms |
194004 KB |
Output is correct |
39 |
Correct |
88 ms |
194012 KB |
Output is correct |
40 |
Correct |
88 ms |
193908 KB |
Output is correct |
41 |
Correct |
88 ms |
193956 KB |
Output is correct |
42 |
Correct |
93 ms |
194272 KB |
Output is correct |
43 |
Correct |
93 ms |
194048 KB |
Output is correct |
44 |
Correct |
89 ms |
194140 KB |
Output is correct |
45 |
Correct |
89 ms |
193940 KB |
Output is correct |
46 |
Correct |
87 ms |
193980 KB |
Output is correct |
47 |
Correct |
91 ms |
193860 KB |
Output is correct |
48 |
Correct |
89 ms |
193988 KB |
Output is correct |
49 |
Correct |
90 ms |
193968 KB |
Output is correct |
50 |
Correct |
81 ms |
192368 KB |
Output is correct |
51 |
Correct |
81 ms |
192456 KB |
Output is correct |
52 |
Correct |
89 ms |
192396 KB |
Output is correct |
53 |
Correct |
109 ms |
192448 KB |
Output is correct |
54 |
Correct |
81 ms |
192452 KB |
Output is correct |
55 |
Correct |
80 ms |
192464 KB |
Output is correct |
56 |
Correct |
81 ms |
192392 KB |
Output is correct |
57 |
Correct |
81 ms |
192372 KB |
Output is correct |
58 |
Correct |
88 ms |
192384 KB |
Output is correct |
59 |
Correct |
80 ms |
192468 KB |
Output is correct |
60 |
Correct |
81 ms |
192428 KB |
Output is correct |
61 |
Correct |
84 ms |
192456 KB |
Output is correct |
62 |
Correct |
81 ms |
192456 KB |
Output is correct |
63 |
Correct |
81 ms |
192456 KB |
Output is correct |
64 |
Correct |
81 ms |
192536 KB |
Output is correct |
65 |
Correct |
81 ms |
192580 KB |
Output is correct |
66 |
Correct |
88 ms |
192556 KB |
Output is correct |
67 |
Correct |
83 ms |
192580 KB |
Output is correct |
68 |
Correct |
81 ms |
192540 KB |
Output is correct |
69 |
Correct |
91 ms |
192524 KB |
Output is correct |
70 |
Correct |
81 ms |
192608 KB |
Output is correct |
71 |
Correct |
88 ms |
192616 KB |
Output is correct |
72 |
Correct |
82 ms |
192496 KB |
Output is correct |
73 |
Correct |
81 ms |
192580 KB |
Output is correct |
74 |
Correct |
90 ms |
192600 KB |
Output is correct |
75 |
Correct |
84 ms |
192548 KB |
Output is correct |
76 |
Correct |
82 ms |
192580 KB |
Output is correct |
77 |
Correct |
81 ms |
192512 KB |
Output is correct |
78 |
Correct |
86 ms |
193952 KB |
Output is correct |
79 |
Correct |
88 ms |
194008 KB |
Output is correct |
80 |
Correct |
89 ms |
193988 KB |
Output is correct |
81 |
Correct |
93 ms |
193968 KB |
Output is correct |
82 |
Correct |
89 ms |
193988 KB |
Output is correct |
83 |
Correct |
87 ms |
193984 KB |
Output is correct |
84 |
Correct |
88 ms |
194052 KB |
Output is correct |
85 |
Correct |
91 ms |
194108 KB |
Output is correct |
86 |
Correct |
89 ms |
194116 KB |
Output is correct |
87 |
Correct |
88 ms |
193956 KB |
Output is correct |
88 |
Correct |
87 ms |
193988 KB |
Output is correct |
89 |
Correct |
88 ms |
193944 KB |
Output is correct |
90 |
Correct |
84 ms |
193884 KB |
Output is correct |
91 |
Correct |
90 ms |
193908 KB |
Output is correct |
92 |
Correct |
327 ms |
217628 KB |
Output is correct |
93 |
Correct |
338 ms |
217716 KB |
Output is correct |
94 |
Correct |
262 ms |
217028 KB |
Output is correct |
95 |
Correct |
187 ms |
217216 KB |
Output is correct |
96 |
Correct |
189 ms |
217204 KB |
Output is correct |
97 |
Correct |
327 ms |
219380 KB |
Output is correct |
98 |
Correct |
314 ms |
219844 KB |
Output is correct |
99 |
Correct |
321 ms |
217528 KB |
Output is correct |
100 |
Correct |
308 ms |
217920 KB |
Output is correct |
101 |
Correct |
317 ms |
217572 KB |
Output is correct |
102 |
Correct |
189 ms |
216852 KB |
Output is correct |
103 |
Correct |
329 ms |
219052 KB |
Output is correct |
104 |
Correct |
323 ms |
218856 KB |
Output is correct |
105 |
Correct |
355 ms |
218916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
192324 KB |
Output is correct |
2 |
Correct |
82 ms |
192496 KB |
Output is correct |
3 |
Correct |
82 ms |
192384 KB |
Output is correct |
4 |
Correct |
93 ms |
192320 KB |
Output is correct |
5 |
Correct |
82 ms |
192428 KB |
Output is correct |
6 |
Correct |
82 ms |
192356 KB |
Output is correct |
7 |
Correct |
82 ms |
192412 KB |
Output is correct |
8 |
Correct |
82 ms |
192368 KB |
Output is correct |
9 |
Correct |
83 ms |
192416 KB |
Output is correct |
10 |
Correct |
83 ms |
192376 KB |
Output is correct |
11 |
Correct |
81 ms |
192328 KB |
Output is correct |
12 |
Correct |
84 ms |
192360 KB |
Output is correct |
13 |
Correct |
82 ms |
192324 KB |
Output is correct |
14 |
Correct |
81 ms |
192384 KB |
Output is correct |
15 |
Correct |
85 ms |
192412 KB |
Output is correct |
16 |
Correct |
80 ms |
192428 KB |
Output is correct |
17 |
Correct |
82 ms |
192384 KB |
Output is correct |
18 |
Correct |
90 ms |
192404 KB |
Output is correct |
19 |
Correct |
84 ms |
192372 KB |
Output is correct |
20 |
Correct |
94 ms |
192324 KB |
Output is correct |
21 |
Correct |
85 ms |
192360 KB |
Output is correct |
22 |
Correct |
85 ms |
192412 KB |
Output is correct |
23 |
Correct |
82 ms |
192324 KB |
Output is correct |
24 |
Correct |
83 ms |
192332 KB |
Output is correct |
25 |
Correct |
83 ms |
192448 KB |
Output is correct |
26 |
Correct |
90 ms |
192636 KB |
Output is correct |
27 |
Correct |
83 ms |
192324 KB |
Output is correct |
28 |
Correct |
86 ms |
192336 KB |
Output is correct |
29 |
Correct |
81 ms |
192376 KB |
Output is correct |
30 |
Correct |
82 ms |
192324 KB |
Output is correct |
31 |
Correct |
80 ms |
192424 KB |
Output is correct |
32 |
Correct |
84 ms |
192336 KB |
Output is correct |
33 |
Correct |
90 ms |
192400 KB |
Output is correct |
34 |
Correct |
82 ms |
192328 KB |
Output is correct |
35 |
Correct |
81 ms |
192328 KB |
Output is correct |
36 |
Correct |
88 ms |
194120 KB |
Output is correct |
37 |
Correct |
96 ms |
194248 KB |
Output is correct |
38 |
Correct |
89 ms |
194004 KB |
Output is correct |
39 |
Correct |
88 ms |
194012 KB |
Output is correct |
40 |
Correct |
88 ms |
193908 KB |
Output is correct |
41 |
Correct |
88 ms |
193956 KB |
Output is correct |
42 |
Correct |
93 ms |
194272 KB |
Output is correct |
43 |
Correct |
93 ms |
194048 KB |
Output is correct |
44 |
Correct |
89 ms |
194140 KB |
Output is correct |
45 |
Correct |
89 ms |
193940 KB |
Output is correct |
46 |
Correct |
87 ms |
193980 KB |
Output is correct |
47 |
Correct |
91 ms |
193860 KB |
Output is correct |
48 |
Correct |
89 ms |
193988 KB |
Output is correct |
49 |
Correct |
90 ms |
193968 KB |
Output is correct |
50 |
Correct |
81 ms |
192368 KB |
Output is correct |
51 |
Correct |
81 ms |
192456 KB |
Output is correct |
52 |
Correct |
89 ms |
192396 KB |
Output is correct |
53 |
Correct |
109 ms |
192448 KB |
Output is correct |
54 |
Correct |
81 ms |
192452 KB |
Output is correct |
55 |
Correct |
80 ms |
192464 KB |
Output is correct |
56 |
Correct |
81 ms |
192392 KB |
Output is correct |
57 |
Correct |
81 ms |
192372 KB |
Output is correct |
58 |
Correct |
88 ms |
192384 KB |
Output is correct |
59 |
Correct |
80 ms |
192468 KB |
Output is correct |
60 |
Correct |
81 ms |
192428 KB |
Output is correct |
61 |
Correct |
84 ms |
192456 KB |
Output is correct |
62 |
Correct |
81 ms |
192456 KB |
Output is correct |
63 |
Correct |
81 ms |
192456 KB |
Output is correct |
64 |
Correct |
81 ms |
192536 KB |
Output is correct |
65 |
Correct |
81 ms |
192580 KB |
Output is correct |
66 |
Correct |
88 ms |
192556 KB |
Output is correct |
67 |
Correct |
83 ms |
192580 KB |
Output is correct |
68 |
Correct |
81 ms |
192540 KB |
Output is correct |
69 |
Correct |
91 ms |
192524 KB |
Output is correct |
70 |
Correct |
81 ms |
192608 KB |
Output is correct |
71 |
Correct |
88 ms |
192616 KB |
Output is correct |
72 |
Correct |
82 ms |
192496 KB |
Output is correct |
73 |
Correct |
81 ms |
192580 KB |
Output is correct |
74 |
Correct |
90 ms |
192600 KB |
Output is correct |
75 |
Correct |
84 ms |
192548 KB |
Output is correct |
76 |
Correct |
82 ms |
192580 KB |
Output is correct |
77 |
Correct |
81 ms |
192512 KB |
Output is correct |
78 |
Correct |
86 ms |
193952 KB |
Output is correct |
79 |
Correct |
88 ms |
194008 KB |
Output is correct |
80 |
Correct |
89 ms |
193988 KB |
Output is correct |
81 |
Correct |
93 ms |
193968 KB |
Output is correct |
82 |
Correct |
89 ms |
193988 KB |
Output is correct |
83 |
Correct |
87 ms |
193984 KB |
Output is correct |
84 |
Correct |
88 ms |
194052 KB |
Output is correct |
85 |
Correct |
91 ms |
194108 KB |
Output is correct |
86 |
Correct |
89 ms |
194116 KB |
Output is correct |
87 |
Correct |
88 ms |
193956 KB |
Output is correct |
88 |
Correct |
87 ms |
193988 KB |
Output is correct |
89 |
Correct |
88 ms |
193944 KB |
Output is correct |
90 |
Correct |
84 ms |
193884 KB |
Output is correct |
91 |
Correct |
90 ms |
193908 KB |
Output is correct |
92 |
Correct |
327 ms |
217628 KB |
Output is correct |
93 |
Correct |
338 ms |
217716 KB |
Output is correct |
94 |
Correct |
262 ms |
217028 KB |
Output is correct |
95 |
Correct |
187 ms |
217216 KB |
Output is correct |
96 |
Correct |
189 ms |
217204 KB |
Output is correct |
97 |
Correct |
327 ms |
219380 KB |
Output is correct |
98 |
Correct |
314 ms |
219844 KB |
Output is correct |
99 |
Correct |
321 ms |
217528 KB |
Output is correct |
100 |
Correct |
308 ms |
217920 KB |
Output is correct |
101 |
Correct |
317 ms |
217572 KB |
Output is correct |
102 |
Correct |
189 ms |
216852 KB |
Output is correct |
103 |
Correct |
329 ms |
219052 KB |
Output is correct |
104 |
Correct |
323 ms |
218856 KB |
Output is correct |
105 |
Correct |
355 ms |
218916 KB |
Output is correct |
106 |
Correct |
5313 ms |
379784 KB |
Output is correct |
107 |
Correct |
5590 ms |
378624 KB |
Output is correct |
108 |
Correct |
6663 ms |
360776 KB |
Output is correct |
109 |
Correct |
6596 ms |
359860 KB |
Output is correct |
110 |
Correct |
6124 ms |
360168 KB |
Output is correct |
111 |
Correct |
1797 ms |
356556 KB |
Output is correct |
112 |
Correct |
5522 ms |
377504 KB |
Output is correct |
113 |
Correct |
6178 ms |
372184 KB |
Output is correct |
114 |
Correct |
6267 ms |
371872 KB |
Output is correct |
115 |
Correct |
6283 ms |
359504 KB |
Output is correct |
116 |
Correct |
6533 ms |
363032 KB |
Output is correct |
117 |
Correct |
4130 ms |
363624 KB |
Output is correct |
118 |
Correct |
1486 ms |
347088 KB |
Output is correct |
119 |
Correct |
1481 ms |
342148 KB |
Output is correct |