#include <bits/stdc++.h>
using namespace std;
#define Fi first
#define Se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3;
const int ADD = 1<<19, INF = 1e9;
struct node {
int pv, mv, cv, val;
void init(int x, int d, int d2) {
pv = d + x, mv = d - x, cv = d2;
val = -INF;
}
node operator+(const node &R) const {
node res;
res.pv = max(pv, R.pv);
res.mv = max(mv, R.mv);
res.cv = max(cv, R.cv);
res.val = max({val, R.val, pv + R.mv});
return res;
}
} T[1<<20];
void init(int x, int d, int d2) {
T[ADD+x].init(x, d, d2);
for(int r=(ADD+x)/2;r;r>>=1) {
T[r] = T[r*2] + T[r*2+1];
}
}
int lvt[100], rvt[100];
node read(int l, int r) {
if(l > r) {
node res; res.init(0, -INF, -INF);
return res;
}
l += ADD, r += ADD;
int lt = 0, rt = 0;
while(l <= r) {
if(l & 1) lvt[lt++] = l++;
if(!(r & 1)) rvt[rt++] = r--;
l >>= 1, r >>= 1;
}
while(rt) lvt[lt++] = rvt[--rt];
node res = T[lvt[0]];
for(int i=1;i<lt;i++) res = res + T[lvt[i]];
return res;
}
int N, M;
vector <int> E[500050];
vector <t3> AE;
int dis[500050], pre[500050];
int far(int x) {
memset(dis, -1, sizeof dis);
vector <int> q;
auto ins_q = [&](int x, int d, int p) { if(dis[x] == -1) q.pb(x), dis[x] = d, pre[x] = p; };
ins_q(x, 0, -1);
rep(i, szz(q)) {
int t = q[i];
for(int e : E[t]) ins_q(e, dis[t] + 1, t);
}
return q.back();
}
int fd[500050], dep[500050], up[500050][20], mxd[500050], dv[500050];
vector <pii> chd[500050], dvl[500050];
int get_l(vector <pii> &h, int d, int e = -1) {
int res = 0, rc = 0;
for(auto &[l, y] : h) if(y != e) {
++rc;
res += l;
if(rc == d) return res;
}
return res;
}
int DL[500050][2];
void pdfs(int x) {
for(int e : E[x]) if(fd[e] == -1) {
fd[e] = fd[x];
dep[e] = dep[x] + 1;
up[e][0] = x;
for(int i=1;i<20;i++) up[e][i] = up[ up[e][i-1] ][i-1];
pdfs(e);
mxd[x] = max(mxd[x], mxd[e] + 1);
dv[x] = max(dv[x], dv[e]);
chd[x].pb({mxd[e]+1, e});
dvl[x].pb({dv[e], e});
}
sort(all(chd[x]), greater<>());
sort(all(dvl[x]), greater<>());
dv[x] = max(dv[x], get_l(chd[x], 2, -1));
}
int get_lca(int x, int y) {
if(dep[x] < dep[y]) swap(x, y);
rep(i, 20) if(1<<i & (dep[x] - dep[y])) x = up[x][i];
for(int i=19;i>=0;i--) if(up[x][i] != up[y][i]) x = up[x][i], y = up[y][i];
return x == y ? x : up[x][0];
}
int climb(int x, int d) {
rep(i, 20) if(1<<i & d) x = up[x][i];
return x;
}
void qdfs(int x, int u = 0, int h = 0, int fa = -1) {
DL[x][1] = max(dv[x], h);
for(int e : E[x]) if(fd[e] == fd[x] && e != fa) {
int du = 0, dh = max({h, get_l(dvl[x], 1, e), get_l(chd[x], 2, e)});
if(fa != -1) du = max(u, get_l(chd[x], 1, e)) + 1;
DL[e][0] = max(du, mxd[e]);
qdfs(e, du, dh, x);
}
}
int main() {
scanf("%d%d", &N, &M);
rep(i, M) {
int x, y, z;
scanf("%d%d%d", &x, &y, &z); ++x; ++y;
if(z == 1) {
E[x].pb(y);
E[y].pb(x);
}
else AE.pb({x, y, z});
}
int l = far(1);
int r = far(l);
int ans = 2 * (N - 1) - dis[r], lend = dis[r];
vector <int> Dia;
for(int t=r;t!=-1;t=pre[t]) Dia.pb(t);
reverse(all(Dia));
memset(fd, -1, sizeof fd);
rep(i, szz(Dia)) fd[Dia[i]] = i;
for(int e : Dia) pdfs(e);
for(int e : Dia) DL[e][0] = -INF, qdfs(e);
int m = szz(Dia);
rep(i, m) init(i, mxd[Dia[i]], dv[Dia[i]]);
for(auto [x, y, d] : AE) {
if(fd[x] > fd[y]) swap(x, y);
if(fd[x] == fd[y]) {
int lca = get_lca(x, y);
int c = dep[x] + dep[y] - 2 * dep[lca];
ans = min(ans, 2 * N - 2 + d - c - lend);
}
else {
int fx = fd[x], fy = fd[y], rx = Dia[fx], ry = Dia[fy];
node n1 = read(0, fx-1), n2 = read(fx+1, fy-1), n3 = read(fy+1, m-1);
int max_d2 = max({DL[x][1], DL[y][1], n1.pv, n2.cv, n3.mv+(m-1)});
int cx = (dep[x] ? climb(x, dep[x]-1) : -1);
int cy = (dep[y] ? climb(y, dep[y]-1) : -1);
max_d2 = max({max_d2, fx + get_l(chd[rx], 1, cx), m-1-fy + get_l(chd[ry], 1, cy)});
int c = fy - fx + dep[x] + dep[y];
ans = min(ans, 2 * N - 2 + d - c - max_d2);
int max_d1 = max(DL[x][0] + max(fy, m-1-fy) + dep[y], DL[y][0] + max(fx, m-1-fx) + dep[x]);
max_d1 = max(max_d1, fx + dep[x] + (m-1-fy) + dep[y]);
max_d1 = max(max_d1, fx + dep[x] + n2.mv + fy + dep[y]);
max_d1 = max(max_d1, dep[x] + n2.pv - fx + (m-1-fy) + dep[y]);
max_d1 = max(max_d1, n2.val + fy - fx + dep[x] + dep[y]);
ans = min(ans, 2 * N - 4 + d - max_d1);
}
}
printf("%d\n", ans);
return 0;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:127:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
127 | scanf("%d%d", &N, &M);
| ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:130:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
130 | scanf("%d%d%d", &x, &y, &z); ++x; ++y;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
16 |
Correct |
27 ms |
39532 KB |
Output is correct |
17 |
Correct |
27 ms |
39552 KB |
Output is correct |
18 |
Correct |
27 ms |
39532 KB |
Output is correct |
19 |
Correct |
28 ms |
39532 KB |
Output is correct |
20 |
Correct |
27 ms |
39532 KB |
Output is correct |
21 |
Correct |
27 ms |
39660 KB |
Output is correct |
22 |
Correct |
27 ms |
39532 KB |
Output is correct |
23 |
Correct |
27 ms |
39532 KB |
Output is correct |
24 |
Correct |
27 ms |
39532 KB |
Output is correct |
25 |
Correct |
27 ms |
39552 KB |
Output is correct |
26 |
Correct |
28 ms |
39532 KB |
Output is correct |
27 |
Correct |
27 ms |
39532 KB |
Output is correct |
28 |
Correct |
27 ms |
39616 KB |
Output is correct |
29 |
Correct |
27 ms |
39532 KB |
Output is correct |
30 |
Correct |
27 ms |
39584 KB |
Output is correct |
31 |
Correct |
27 ms |
39532 KB |
Output is correct |
32 |
Correct |
27 ms |
39532 KB |
Output is correct |
33 |
Correct |
27 ms |
39532 KB |
Output is correct |
34 |
Correct |
27 ms |
39532 KB |
Output is correct |
35 |
Correct |
28 ms |
39532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
40172 KB |
Output is correct |
2 |
Correct |
34 ms |
40172 KB |
Output is correct |
3 |
Correct |
36 ms |
40940 KB |
Output is correct |
4 |
Correct |
36 ms |
40812 KB |
Output is correct |
5 |
Correct |
35 ms |
40812 KB |
Output is correct |
6 |
Correct |
33 ms |
40684 KB |
Output is correct |
7 |
Correct |
37 ms |
40300 KB |
Output is correct |
8 |
Correct |
35 ms |
40684 KB |
Output is correct |
9 |
Correct |
35 ms |
40684 KB |
Output is correct |
10 |
Correct |
35 ms |
40812 KB |
Output is correct |
11 |
Correct |
35 ms |
40812 KB |
Output is correct |
12 |
Correct |
37 ms |
40824 KB |
Output is correct |
13 |
Correct |
35 ms |
40812 KB |
Output is correct |
14 |
Correct |
35 ms |
40812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
16 |
Correct |
27 ms |
39532 KB |
Output is correct |
17 |
Correct |
27 ms |
39552 KB |
Output is correct |
18 |
Correct |
27 ms |
39532 KB |
Output is correct |
19 |
Correct |
28 ms |
39532 KB |
Output is correct |
20 |
Correct |
27 ms |
39532 KB |
Output is correct |
21 |
Correct |
27 ms |
39660 KB |
Output is correct |
22 |
Correct |
27 ms |
39532 KB |
Output is correct |
23 |
Correct |
27 ms |
39532 KB |
Output is correct |
24 |
Correct |
27 ms |
39532 KB |
Output is correct |
25 |
Correct |
27 ms |
39552 KB |
Output is correct |
26 |
Correct |
28 ms |
39532 KB |
Output is correct |
27 |
Correct |
27 ms |
39532 KB |
Output is correct |
28 |
Correct |
27 ms |
39616 KB |
Output is correct |
29 |
Correct |
27 ms |
39532 KB |
Output is correct |
30 |
Correct |
27 ms |
39584 KB |
Output is correct |
31 |
Correct |
27 ms |
39532 KB |
Output is correct |
32 |
Correct |
27 ms |
39532 KB |
Output is correct |
33 |
Correct |
27 ms |
39532 KB |
Output is correct |
34 |
Correct |
27 ms |
39532 KB |
Output is correct |
35 |
Correct |
28 ms |
39532 KB |
Output is correct |
36 |
Correct |
27 ms |
39532 KB |
Output is correct |
37 |
Correct |
27 ms |
39532 KB |
Output is correct |
38 |
Correct |
27 ms |
39660 KB |
Output is correct |
39 |
Correct |
27 ms |
39660 KB |
Output is correct |
40 |
Correct |
27 ms |
39660 KB |
Output is correct |
41 |
Correct |
27 ms |
39660 KB |
Output is correct |
42 |
Correct |
27 ms |
39532 KB |
Output is correct |
43 |
Correct |
28 ms |
39648 KB |
Output is correct |
44 |
Correct |
27 ms |
39660 KB |
Output is correct |
45 |
Correct |
27 ms |
39660 KB |
Output is correct |
46 |
Correct |
27 ms |
39660 KB |
Output is correct |
47 |
Correct |
27 ms |
39660 KB |
Output is correct |
48 |
Correct |
27 ms |
39788 KB |
Output is correct |
49 |
Correct |
27 ms |
39660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
16 |
Correct |
27 ms |
39532 KB |
Output is correct |
17 |
Correct |
27 ms |
39552 KB |
Output is correct |
18 |
Correct |
27 ms |
39532 KB |
Output is correct |
19 |
Correct |
28 ms |
39532 KB |
Output is correct |
20 |
Correct |
27 ms |
39532 KB |
Output is correct |
21 |
Correct |
27 ms |
39660 KB |
Output is correct |
22 |
Correct |
27 ms |
39532 KB |
Output is correct |
23 |
Correct |
27 ms |
39532 KB |
Output is correct |
24 |
Correct |
27 ms |
39532 KB |
Output is correct |
25 |
Correct |
27 ms |
39552 KB |
Output is correct |
26 |
Correct |
28 ms |
39532 KB |
Output is correct |
27 |
Correct |
27 ms |
39532 KB |
Output is correct |
28 |
Correct |
27 ms |
39616 KB |
Output is correct |
29 |
Correct |
27 ms |
39532 KB |
Output is correct |
30 |
Correct |
27 ms |
39584 KB |
Output is correct |
31 |
Correct |
27 ms |
39532 KB |
Output is correct |
32 |
Correct |
27 ms |
39532 KB |
Output is correct |
33 |
Correct |
27 ms |
39532 KB |
Output is correct |
34 |
Correct |
27 ms |
39532 KB |
Output is correct |
35 |
Correct |
28 ms |
39532 KB |
Output is correct |
36 |
Correct |
27 ms |
39532 KB |
Output is correct |
37 |
Correct |
27 ms |
39532 KB |
Output is correct |
38 |
Correct |
27 ms |
39660 KB |
Output is correct |
39 |
Correct |
27 ms |
39660 KB |
Output is correct |
40 |
Correct |
27 ms |
39660 KB |
Output is correct |
41 |
Correct |
27 ms |
39660 KB |
Output is correct |
42 |
Correct |
27 ms |
39532 KB |
Output is correct |
43 |
Correct |
28 ms |
39648 KB |
Output is correct |
44 |
Correct |
27 ms |
39660 KB |
Output is correct |
45 |
Correct |
27 ms |
39660 KB |
Output is correct |
46 |
Correct |
27 ms |
39660 KB |
Output is correct |
47 |
Correct |
27 ms |
39660 KB |
Output is correct |
48 |
Correct |
27 ms |
39788 KB |
Output is correct |
49 |
Correct |
27 ms |
39660 KB |
Output is correct |
50 |
Correct |
28 ms |
39660 KB |
Output is correct |
51 |
Correct |
27 ms |
39660 KB |
Output is correct |
52 |
Correct |
28 ms |
39660 KB |
Output is correct |
53 |
Correct |
28 ms |
39660 KB |
Output is correct |
54 |
Correct |
28 ms |
39660 KB |
Output is correct |
55 |
Correct |
27 ms |
39660 KB |
Output is correct |
56 |
Correct |
27 ms |
39660 KB |
Output is correct |
57 |
Correct |
28 ms |
39660 KB |
Output is correct |
58 |
Correct |
27 ms |
39660 KB |
Output is correct |
59 |
Correct |
28 ms |
39660 KB |
Output is correct |
60 |
Correct |
27 ms |
39660 KB |
Output is correct |
61 |
Correct |
27 ms |
39660 KB |
Output is correct |
62 |
Correct |
27 ms |
39660 KB |
Output is correct |
63 |
Correct |
29 ms |
39660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
16 |
Correct |
27 ms |
39532 KB |
Output is correct |
17 |
Correct |
27 ms |
39552 KB |
Output is correct |
18 |
Correct |
27 ms |
39532 KB |
Output is correct |
19 |
Correct |
28 ms |
39532 KB |
Output is correct |
20 |
Correct |
27 ms |
39532 KB |
Output is correct |
21 |
Correct |
27 ms |
39660 KB |
Output is correct |
22 |
Correct |
27 ms |
39532 KB |
Output is correct |
23 |
Correct |
27 ms |
39532 KB |
Output is correct |
24 |
Correct |
27 ms |
39532 KB |
Output is correct |
25 |
Correct |
27 ms |
39552 KB |
Output is correct |
26 |
Correct |
28 ms |
39532 KB |
Output is correct |
27 |
Correct |
27 ms |
39532 KB |
Output is correct |
28 |
Correct |
27 ms |
39616 KB |
Output is correct |
29 |
Correct |
27 ms |
39532 KB |
Output is correct |
30 |
Correct |
27 ms |
39584 KB |
Output is correct |
31 |
Correct |
27 ms |
39532 KB |
Output is correct |
32 |
Correct |
27 ms |
39532 KB |
Output is correct |
33 |
Correct |
27 ms |
39532 KB |
Output is correct |
34 |
Correct |
27 ms |
39532 KB |
Output is correct |
35 |
Correct |
28 ms |
39532 KB |
Output is correct |
36 |
Correct |
43 ms |
40172 KB |
Output is correct |
37 |
Correct |
34 ms |
40172 KB |
Output is correct |
38 |
Correct |
36 ms |
40940 KB |
Output is correct |
39 |
Correct |
36 ms |
40812 KB |
Output is correct |
40 |
Correct |
35 ms |
40812 KB |
Output is correct |
41 |
Correct |
33 ms |
40684 KB |
Output is correct |
42 |
Correct |
37 ms |
40300 KB |
Output is correct |
43 |
Correct |
35 ms |
40684 KB |
Output is correct |
44 |
Correct |
35 ms |
40684 KB |
Output is correct |
45 |
Correct |
35 ms |
40812 KB |
Output is correct |
46 |
Correct |
35 ms |
40812 KB |
Output is correct |
47 |
Correct |
37 ms |
40824 KB |
Output is correct |
48 |
Correct |
35 ms |
40812 KB |
Output is correct |
49 |
Correct |
35 ms |
40812 KB |
Output is correct |
50 |
Correct |
27 ms |
39532 KB |
Output is correct |
51 |
Correct |
27 ms |
39532 KB |
Output is correct |
52 |
Correct |
27 ms |
39660 KB |
Output is correct |
53 |
Correct |
27 ms |
39660 KB |
Output is correct |
54 |
Correct |
27 ms |
39660 KB |
Output is correct |
55 |
Correct |
27 ms |
39660 KB |
Output is correct |
56 |
Correct |
27 ms |
39532 KB |
Output is correct |
57 |
Correct |
28 ms |
39648 KB |
Output is correct |
58 |
Correct |
27 ms |
39660 KB |
Output is correct |
59 |
Correct |
27 ms |
39660 KB |
Output is correct |
60 |
Correct |
27 ms |
39660 KB |
Output is correct |
61 |
Correct |
27 ms |
39660 KB |
Output is correct |
62 |
Correct |
27 ms |
39788 KB |
Output is correct |
63 |
Correct |
27 ms |
39660 KB |
Output is correct |
64 |
Correct |
28 ms |
39660 KB |
Output is correct |
65 |
Correct |
27 ms |
39660 KB |
Output is correct |
66 |
Correct |
28 ms |
39660 KB |
Output is correct |
67 |
Correct |
28 ms |
39660 KB |
Output is correct |
68 |
Correct |
28 ms |
39660 KB |
Output is correct |
69 |
Correct |
27 ms |
39660 KB |
Output is correct |
70 |
Correct |
27 ms |
39660 KB |
Output is correct |
71 |
Correct |
28 ms |
39660 KB |
Output is correct |
72 |
Correct |
27 ms |
39660 KB |
Output is correct |
73 |
Correct |
28 ms |
39660 KB |
Output is correct |
74 |
Correct |
27 ms |
39660 KB |
Output is correct |
75 |
Correct |
27 ms |
39660 KB |
Output is correct |
76 |
Correct |
27 ms |
39660 KB |
Output is correct |
77 |
Correct |
29 ms |
39660 KB |
Output is correct |
78 |
Correct |
34 ms |
40172 KB |
Output is correct |
79 |
Correct |
35 ms |
40300 KB |
Output is correct |
80 |
Correct |
36 ms |
40940 KB |
Output is correct |
81 |
Correct |
36 ms |
40940 KB |
Output is correct |
82 |
Correct |
35 ms |
40812 KB |
Output is correct |
83 |
Correct |
33 ms |
40684 KB |
Output is correct |
84 |
Correct |
35 ms |
40300 KB |
Output is correct |
85 |
Correct |
36 ms |
40812 KB |
Output is correct |
86 |
Correct |
35 ms |
40684 KB |
Output is correct |
87 |
Correct |
35 ms |
40812 KB |
Output is correct |
88 |
Correct |
35 ms |
40812 KB |
Output is correct |
89 |
Correct |
34 ms |
40808 KB |
Output is correct |
90 |
Correct |
32 ms |
40684 KB |
Output is correct |
91 |
Correct |
32 ms |
40684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
16 |
Correct |
27 ms |
39532 KB |
Output is correct |
17 |
Correct |
27 ms |
39552 KB |
Output is correct |
18 |
Correct |
27 ms |
39532 KB |
Output is correct |
19 |
Correct |
28 ms |
39532 KB |
Output is correct |
20 |
Correct |
27 ms |
39532 KB |
Output is correct |
21 |
Correct |
27 ms |
39660 KB |
Output is correct |
22 |
Correct |
27 ms |
39532 KB |
Output is correct |
23 |
Correct |
27 ms |
39532 KB |
Output is correct |
24 |
Correct |
27 ms |
39532 KB |
Output is correct |
25 |
Correct |
27 ms |
39552 KB |
Output is correct |
26 |
Correct |
28 ms |
39532 KB |
Output is correct |
27 |
Correct |
27 ms |
39532 KB |
Output is correct |
28 |
Correct |
27 ms |
39616 KB |
Output is correct |
29 |
Correct |
27 ms |
39532 KB |
Output is correct |
30 |
Correct |
27 ms |
39584 KB |
Output is correct |
31 |
Correct |
27 ms |
39532 KB |
Output is correct |
32 |
Correct |
27 ms |
39532 KB |
Output is correct |
33 |
Correct |
27 ms |
39532 KB |
Output is correct |
34 |
Correct |
27 ms |
39532 KB |
Output is correct |
35 |
Correct |
28 ms |
39532 KB |
Output is correct |
36 |
Correct |
43 ms |
40172 KB |
Output is correct |
37 |
Correct |
34 ms |
40172 KB |
Output is correct |
38 |
Correct |
36 ms |
40940 KB |
Output is correct |
39 |
Correct |
36 ms |
40812 KB |
Output is correct |
40 |
Correct |
35 ms |
40812 KB |
Output is correct |
41 |
Correct |
33 ms |
40684 KB |
Output is correct |
42 |
Correct |
37 ms |
40300 KB |
Output is correct |
43 |
Correct |
35 ms |
40684 KB |
Output is correct |
44 |
Correct |
35 ms |
40684 KB |
Output is correct |
45 |
Correct |
35 ms |
40812 KB |
Output is correct |
46 |
Correct |
35 ms |
40812 KB |
Output is correct |
47 |
Correct |
37 ms |
40824 KB |
Output is correct |
48 |
Correct |
35 ms |
40812 KB |
Output is correct |
49 |
Correct |
35 ms |
40812 KB |
Output is correct |
50 |
Correct |
27 ms |
39532 KB |
Output is correct |
51 |
Correct |
27 ms |
39532 KB |
Output is correct |
52 |
Correct |
27 ms |
39660 KB |
Output is correct |
53 |
Correct |
27 ms |
39660 KB |
Output is correct |
54 |
Correct |
27 ms |
39660 KB |
Output is correct |
55 |
Correct |
27 ms |
39660 KB |
Output is correct |
56 |
Correct |
27 ms |
39532 KB |
Output is correct |
57 |
Correct |
28 ms |
39648 KB |
Output is correct |
58 |
Correct |
27 ms |
39660 KB |
Output is correct |
59 |
Correct |
27 ms |
39660 KB |
Output is correct |
60 |
Correct |
27 ms |
39660 KB |
Output is correct |
61 |
Correct |
27 ms |
39660 KB |
Output is correct |
62 |
Correct |
27 ms |
39788 KB |
Output is correct |
63 |
Correct |
27 ms |
39660 KB |
Output is correct |
64 |
Correct |
28 ms |
39660 KB |
Output is correct |
65 |
Correct |
27 ms |
39660 KB |
Output is correct |
66 |
Correct |
28 ms |
39660 KB |
Output is correct |
67 |
Correct |
28 ms |
39660 KB |
Output is correct |
68 |
Correct |
28 ms |
39660 KB |
Output is correct |
69 |
Correct |
27 ms |
39660 KB |
Output is correct |
70 |
Correct |
27 ms |
39660 KB |
Output is correct |
71 |
Correct |
28 ms |
39660 KB |
Output is correct |
72 |
Correct |
27 ms |
39660 KB |
Output is correct |
73 |
Correct |
28 ms |
39660 KB |
Output is correct |
74 |
Correct |
27 ms |
39660 KB |
Output is correct |
75 |
Correct |
27 ms |
39660 KB |
Output is correct |
76 |
Correct |
27 ms |
39660 KB |
Output is correct |
77 |
Correct |
29 ms |
39660 KB |
Output is correct |
78 |
Correct |
34 ms |
40172 KB |
Output is correct |
79 |
Correct |
35 ms |
40300 KB |
Output is correct |
80 |
Correct |
36 ms |
40940 KB |
Output is correct |
81 |
Correct |
36 ms |
40940 KB |
Output is correct |
82 |
Correct |
35 ms |
40812 KB |
Output is correct |
83 |
Correct |
33 ms |
40684 KB |
Output is correct |
84 |
Correct |
35 ms |
40300 KB |
Output is correct |
85 |
Correct |
36 ms |
40812 KB |
Output is correct |
86 |
Correct |
35 ms |
40684 KB |
Output is correct |
87 |
Correct |
35 ms |
40812 KB |
Output is correct |
88 |
Correct |
35 ms |
40812 KB |
Output is correct |
89 |
Correct |
34 ms |
40808 KB |
Output is correct |
90 |
Correct |
32 ms |
40684 KB |
Output is correct |
91 |
Correct |
32 ms |
40684 KB |
Output is correct |
92 |
Correct |
270 ms |
60200 KB |
Output is correct |
93 |
Correct |
248 ms |
58928 KB |
Output is correct |
94 |
Correct |
226 ms |
60064 KB |
Output is correct |
95 |
Correct |
177 ms |
58220 KB |
Output is correct |
96 |
Correct |
176 ms |
58084 KB |
Output is correct |
97 |
Correct |
227 ms |
50080 KB |
Output is correct |
98 |
Correct |
213 ms |
49568 KB |
Output is correct |
99 |
Correct |
245 ms |
60064 KB |
Output is correct |
100 |
Correct |
271 ms |
59688 KB |
Output is correct |
101 |
Correct |
267 ms |
59296 KB |
Output is correct |
102 |
Correct |
162 ms |
55712 KB |
Output is correct |
103 |
Correct |
217 ms |
49696 KB |
Output is correct |
104 |
Correct |
261 ms |
56736 KB |
Output is correct |
105 |
Correct |
247 ms |
56224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
39532 KB |
Output is correct |
2 |
Correct |
28 ms |
39532 KB |
Output is correct |
3 |
Correct |
27 ms |
39532 KB |
Output is correct |
4 |
Correct |
27 ms |
39532 KB |
Output is correct |
5 |
Correct |
27 ms |
39532 KB |
Output is correct |
6 |
Correct |
27 ms |
39552 KB |
Output is correct |
7 |
Correct |
27 ms |
39532 KB |
Output is correct |
8 |
Correct |
27 ms |
39532 KB |
Output is correct |
9 |
Correct |
27 ms |
39532 KB |
Output is correct |
10 |
Correct |
27 ms |
39532 KB |
Output is correct |
11 |
Correct |
27 ms |
39532 KB |
Output is correct |
12 |
Correct |
27 ms |
39552 KB |
Output is correct |
13 |
Correct |
27 ms |
39532 KB |
Output is correct |
14 |
Correct |
27 ms |
39532 KB |
Output is correct |
15 |
Correct |
27 ms |
39552 KB |
Output is correct |
16 |
Correct |
27 ms |
39532 KB |
Output is correct |
17 |
Correct |
27 ms |
39552 KB |
Output is correct |
18 |
Correct |
27 ms |
39532 KB |
Output is correct |
19 |
Correct |
28 ms |
39532 KB |
Output is correct |
20 |
Correct |
27 ms |
39532 KB |
Output is correct |
21 |
Correct |
27 ms |
39660 KB |
Output is correct |
22 |
Correct |
27 ms |
39532 KB |
Output is correct |
23 |
Correct |
27 ms |
39532 KB |
Output is correct |
24 |
Correct |
27 ms |
39532 KB |
Output is correct |
25 |
Correct |
27 ms |
39552 KB |
Output is correct |
26 |
Correct |
28 ms |
39532 KB |
Output is correct |
27 |
Correct |
27 ms |
39532 KB |
Output is correct |
28 |
Correct |
27 ms |
39616 KB |
Output is correct |
29 |
Correct |
27 ms |
39532 KB |
Output is correct |
30 |
Correct |
27 ms |
39584 KB |
Output is correct |
31 |
Correct |
27 ms |
39532 KB |
Output is correct |
32 |
Correct |
27 ms |
39532 KB |
Output is correct |
33 |
Correct |
27 ms |
39532 KB |
Output is correct |
34 |
Correct |
27 ms |
39532 KB |
Output is correct |
35 |
Correct |
28 ms |
39532 KB |
Output is correct |
36 |
Correct |
43 ms |
40172 KB |
Output is correct |
37 |
Correct |
34 ms |
40172 KB |
Output is correct |
38 |
Correct |
36 ms |
40940 KB |
Output is correct |
39 |
Correct |
36 ms |
40812 KB |
Output is correct |
40 |
Correct |
35 ms |
40812 KB |
Output is correct |
41 |
Correct |
33 ms |
40684 KB |
Output is correct |
42 |
Correct |
37 ms |
40300 KB |
Output is correct |
43 |
Correct |
35 ms |
40684 KB |
Output is correct |
44 |
Correct |
35 ms |
40684 KB |
Output is correct |
45 |
Correct |
35 ms |
40812 KB |
Output is correct |
46 |
Correct |
35 ms |
40812 KB |
Output is correct |
47 |
Correct |
37 ms |
40824 KB |
Output is correct |
48 |
Correct |
35 ms |
40812 KB |
Output is correct |
49 |
Correct |
35 ms |
40812 KB |
Output is correct |
50 |
Correct |
27 ms |
39532 KB |
Output is correct |
51 |
Correct |
27 ms |
39532 KB |
Output is correct |
52 |
Correct |
27 ms |
39660 KB |
Output is correct |
53 |
Correct |
27 ms |
39660 KB |
Output is correct |
54 |
Correct |
27 ms |
39660 KB |
Output is correct |
55 |
Correct |
27 ms |
39660 KB |
Output is correct |
56 |
Correct |
27 ms |
39532 KB |
Output is correct |
57 |
Correct |
28 ms |
39648 KB |
Output is correct |
58 |
Correct |
27 ms |
39660 KB |
Output is correct |
59 |
Correct |
27 ms |
39660 KB |
Output is correct |
60 |
Correct |
27 ms |
39660 KB |
Output is correct |
61 |
Correct |
27 ms |
39660 KB |
Output is correct |
62 |
Correct |
27 ms |
39788 KB |
Output is correct |
63 |
Correct |
27 ms |
39660 KB |
Output is correct |
64 |
Correct |
28 ms |
39660 KB |
Output is correct |
65 |
Correct |
27 ms |
39660 KB |
Output is correct |
66 |
Correct |
28 ms |
39660 KB |
Output is correct |
67 |
Correct |
28 ms |
39660 KB |
Output is correct |
68 |
Correct |
28 ms |
39660 KB |
Output is correct |
69 |
Correct |
27 ms |
39660 KB |
Output is correct |
70 |
Correct |
27 ms |
39660 KB |
Output is correct |
71 |
Correct |
28 ms |
39660 KB |
Output is correct |
72 |
Correct |
27 ms |
39660 KB |
Output is correct |
73 |
Correct |
28 ms |
39660 KB |
Output is correct |
74 |
Correct |
27 ms |
39660 KB |
Output is correct |
75 |
Correct |
27 ms |
39660 KB |
Output is correct |
76 |
Correct |
27 ms |
39660 KB |
Output is correct |
77 |
Correct |
29 ms |
39660 KB |
Output is correct |
78 |
Correct |
34 ms |
40172 KB |
Output is correct |
79 |
Correct |
35 ms |
40300 KB |
Output is correct |
80 |
Correct |
36 ms |
40940 KB |
Output is correct |
81 |
Correct |
36 ms |
40940 KB |
Output is correct |
82 |
Correct |
35 ms |
40812 KB |
Output is correct |
83 |
Correct |
33 ms |
40684 KB |
Output is correct |
84 |
Correct |
35 ms |
40300 KB |
Output is correct |
85 |
Correct |
36 ms |
40812 KB |
Output is correct |
86 |
Correct |
35 ms |
40684 KB |
Output is correct |
87 |
Correct |
35 ms |
40812 KB |
Output is correct |
88 |
Correct |
35 ms |
40812 KB |
Output is correct |
89 |
Correct |
34 ms |
40808 KB |
Output is correct |
90 |
Correct |
32 ms |
40684 KB |
Output is correct |
91 |
Correct |
32 ms |
40684 KB |
Output is correct |
92 |
Correct |
270 ms |
60200 KB |
Output is correct |
93 |
Correct |
248 ms |
58928 KB |
Output is correct |
94 |
Correct |
226 ms |
60064 KB |
Output is correct |
95 |
Correct |
177 ms |
58220 KB |
Output is correct |
96 |
Correct |
176 ms |
58084 KB |
Output is correct |
97 |
Correct |
227 ms |
50080 KB |
Output is correct |
98 |
Correct |
213 ms |
49568 KB |
Output is correct |
99 |
Correct |
245 ms |
60064 KB |
Output is correct |
100 |
Correct |
271 ms |
59688 KB |
Output is correct |
101 |
Correct |
267 ms |
59296 KB |
Output is correct |
102 |
Correct |
162 ms |
55712 KB |
Output is correct |
103 |
Correct |
217 ms |
49696 KB |
Output is correct |
104 |
Correct |
261 ms |
56736 KB |
Output is correct |
105 |
Correct |
247 ms |
56224 KB |
Output is correct |
106 |
Correct |
3433 ms |
100820 KB |
Output is correct |
107 |
Correct |
3550 ms |
100696 KB |
Output is correct |
108 |
Correct |
4067 ms |
167804 KB |
Output is correct |
109 |
Correct |
4260 ms |
164248 KB |
Output is correct |
110 |
Correct |
4274 ms |
162796 KB |
Output is correct |
111 |
Correct |
1852 ms |
175044 KB |
Output is correct |
112 |
Correct |
3460 ms |
138316 KB |
Output is correct |
113 |
Correct |
4391 ms |
183980 KB |
Output is correct |
114 |
Correct |
4230 ms |
180964 KB |
Output is correct |
115 |
Correct |
4094 ms |
201800 KB |
Output is correct |
116 |
Correct |
3980 ms |
195028 KB |
Output is correct |
117 |
Correct |
2826 ms |
201944 KB |
Output is correct |
118 |
Correct |
1437 ms |
156488 KB |
Output is correct |
119 |
Correct |
1420 ms |
156616 KB |
Output is correct |