#include "closing.h" // do not change this
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair <ll,ll > ii;
typedef pair <ii,ll> iii;
const char nl= '\n';
const int Na=2e5+5;
int n,x,y;
ll k;
vector <ii> vt[Na];
ll res=0;
ll dp[Na][2];
bool cp[Na];
void dijkstra(int u,int dd)
{
priority_queue<ii,vector <ii>,greater <ii> > qu;
for (int i=0; i<n; i++)
{
dp[i][dd]=1e18+5;
cp[i]=0;
}
dp[u][dd]=0;
qu.push({0,u});
while (!qu.empty())
{
ii aa=qu.top();
qu.pop();
if (cp[aa.se]==1)
{
continue;
}
cp[aa.se]=1;
for (auto v:vt[aa.se])
{
if (dp[v.fi][dd]>dp[aa.se][dd]+v.se)
{
dp[v.fi][dd]=dp[aa.se][dd]+v.se;
qu.push({dp[v.fi][dd],v.fi});
}
}
}
}
void solve1()
{
dijkstra(x,0);
dijkstra(y,1);
vector <ll> cnt;
for (int i=0; i<n; i++)
{
cnt.pb(min(dp[i][0],dp[i][1]));
}
ll ans=0;
ll dem=0;
sort (cnt.begin(),cnt.end());
for (auto v:cnt)
{
if (dem+v<=k)
{
dem+=v;
ans++;
}
else break;
}
res=ans;
}
bool check[Na];
void dfs(int u,int vv)
{
if (u==y)
{
check[u]=1;
return;
}
for (auto v:vt[u])
{
if (v.fi==vv)
{
continue;
}
dfs(v.fi,u);
if (check[v.fi]==1)
{
check[u]=1;
}
}
}
/*const int M=3005;
ll dpa[M][M*2];
void solve2()
{
for (int i=0;i<n;i++)
{
check[i]=0;
}
dfs(x,-1);
for (int i=0;i<n;i++)
{
for (int j=0;j<=2*n;j++)
{
dpa[i][j]=1e18+5;
}
}
if (check[0]==1)
{
dpa[0][1]=min(dp[0][1],dp[0][0]);
dpa[0][2]=max(dp[0][1],dp[0][0]);
}
else
{
dpa[0][0]=0;
dpa[0][1]=min(dp[0][1],dp[0][0]);
dpa[0][2]=max(dp[0][1],dp[0][0]);
}
for (int i=1;i<n;i++)
{
for (int j=0;j<=2*(i+1);j++)
{
if (check[i]==1)
{
if (j>=1){
dpa[i][j]=min(dpa[i][j],min(dp[i][0],dp[i][1])+dpa[i-1][j-1]);
}
if (j>=2)
{
dpa[i][j]=min(dpa[i][j],max(dp[i][0],dp[i][1])+dpa[i-1][j-2]);
}
}
else
{
dpa[i][j]=dpa[i-1][j];
if (j>=1){
dpa[i][j]=min(dpa[i][j],min(dp[i][0],dp[i][1])+dpa[i-1][j-1]);
}
if (j>=2)
{
dpa[i][j]=min(dpa[i][j],max(dp[i][0],dp[i][1])+dpa[i-1][j-2]);
}
}
}
}
for (int j=0;j<=2*n;j++)
{
//cout<<j<<" "<<dpa[n][j]<<" "<<k<<nl;
if (dpa[n-1][j]<=k)
{
res=max(res,j);
}
}
}*/
ii T[8*Na];
void build (int node,int l,int r)
{
if (l==r)
{
T[node]= {0,0};
return;
}
build(node*2,l,(l+r)/2);
build(node*2+1,(l+r)/2+1,r);
T[node]= {0,0};
}
void update(int node,int l,int r,int u,ii val)
{
if (l>u||r<u)
{
return;
}
if (l==r)
{
T[node].fi+=val.fi;
T[node].se+=val.se;
return;
}
update(node*2,l,(l+r)/2,u,val);
update(node*2+1,(l+r)/2+1,r,u,val);
T[node].fi=T[node*2].fi+T[node*2+1].fi;
T[node].se=T[node*2].se+T[node*2+1].se;
}
ll sum;
ii query(int node,int l,int r,ll val)
{
//cout<<l<<" "<<r<<" "<<T[node].se<<nl;
if (l==r)
{
sum+=T[node].fi;
return {T[node].se,l};
}
int mid=(l+r)/2;
if (T[node*2].fi<val)
{
sum+=T[node*2].fi;
ii bb=query(node*2+1,mid+1,r,val-T[node*2].fi);
return {bb.fi+T[node*2].se,bb.se};
}
ii bb=query(node*2,l,mid,val);
return bb;
}
void solve3()
{
vector <ll> tmp;
for (int i=0; i<n; i++)
{
check[i]=0;
}
dfs(x,-1);
ll resa=0;
ll dem=0;
vector <ii> gg;
for (int i=0; i<n; i++)
{
if (check[i]==1)
{
resa+=min(dp[i][0],dp[i][1]);
tmp.pb(abs(dp[i][0]-dp[i][1]));
dem++;
}
else
{
tmp.pb(min(dp[i][0],dp[i][1]));
tmp.pb(abs(dp[i][0]-dp[i][1]));
gg.pb({max(dp[i][0],dp[i][1]),i});
}
}
sort (gg.begin(),gg.end());
sort (tmp.begin(),tmp.end());
tmp.resize(unique(tmp.begin(),tmp.end())-tmp.begin());
build(1,1,tmp.size());
if (resa>k)
{
return;
}
for (int i=0; i<n; i++)
{
if (check[i]==1)
{
ll aa=lower_bound(tmp.begin(),tmp.end(),abs(dp[i][0]-dp[i][1]))-tmp.begin()+1;
update(1,1,tmp.size(),aa, {abs(dp[i][0]-dp[i][1]),1});
}
else
{
ll aa=lower_bound(tmp.begin(),tmp.end(),min(dp[i][0],dp[i][1]))-tmp.begin()+1;
update(1,1,tmp.size(),aa, {min(dp[i][0],dp[i][1]),1});
}
}
ll ans=0;
{
ll h2=0;
sum=0;
ii h1=query(1,1,tmp.size(),k-resa);
h2=h1.fi;
ll gg=tmp[h1.se-1];
if (sum>k-resa)
{
ll rr=(sum-k+resa)/gg;
if (rr*gg<sum-k+resa)
{
rr++;
}
h2-=rr;
}
res=max(res,ans+dem+h2);
}
for (auto v:gg)
{
ans++;
ll aa=lower_bound(tmp.begin(),tmp.end(),min(dp[v.se][0],dp[v.se][1]))-tmp.begin()+1;
update(1,1,tmp.size(),aa, {-min(dp[v.se][0],dp[v.se][1]),-1});
ll bb=lower_bound(tmp.begin(),tmp.end(),abs(dp[v.se][0]-dp[v.se][1]))-tmp.begin()+1;
update(1,1,tmp.size(),bb, {abs(dp[v.se][0]-dp[v.se][1]),1});
//cout<<v.se<<" "<<abs(dp[v.se][0]-dp[v.se][1])<<nl;
resa+=min(dp[v.se][0],dp[v.se][1]);
if (resa<=k)
{
ll h2=0;
sum=0;
ii h1=query(1,1,tmp.size(),k-resa);
h2=h1.fi;
ll gg=tmp[h1.se-1];
if (sum>k-resa)
{
ll rr=(sum-k+resa)/gg;
if (rr*gg<sum-k+resa)
{
rr++;
}
h2-=rr;
}
res=max(res,ans+dem+h2);
//cout<<sum-k+resa<<" "<<res<<" "<<ans+dem+h2<<" "<<ans<<" "<<dem<<" "<<h2<<" "<<k-resa<<nl;
}
}
}
ll dema=0;
int max_score(int N, int X, int Y, long long K, std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
n=N;
x=X;
y=Y;
k=K;
res=0;
dema+=N;
for (int i=0; i<n; i++)
{
vt[i].clear();
}
for (int i=0; i<n-1; i++)
{
vt[U[i]].pb({V[i],W[i]});
vt[V[i]].pb({U[i],W[i]});
}
solve1();
/*if (n<=3000&&dema<=3000){
solve2();
}*/
solve3();
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
181 ms |
44656 KB |
Output is correct |
2 |
Correct |
157 ms |
47804 KB |
Output is correct |
3 |
Correct |
87 ms |
11588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8792 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8796 KB |
Output is correct |
4 |
Correct |
2 ms |
8792 KB |
Output is correct |
5 |
Correct |
2 ms |
8796 KB |
Output is correct |
6 |
Correct |
1 ms |
8796 KB |
Output is correct |
7 |
Correct |
2 ms |
8796 KB |
Output is correct |
8 |
Correct |
1 ms |
8796 KB |
Output is correct |
9 |
Correct |
2 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8792 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8796 KB |
Output is correct |
4 |
Correct |
2 ms |
8792 KB |
Output is correct |
5 |
Correct |
2 ms |
8796 KB |
Output is correct |
6 |
Correct |
1 ms |
8796 KB |
Output is correct |
7 |
Correct |
2 ms |
8796 KB |
Output is correct |
8 |
Correct |
1 ms |
8796 KB |
Output is correct |
9 |
Correct |
2 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8888 KB |
Output is correct |
14 |
Correct |
2 ms |
8796 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8796 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8796 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
2 ms |
8884 KB |
Output is correct |
21 |
Correct |
2 ms |
8796 KB |
Output is correct |
22 |
Correct |
3 ms |
9048 KB |
Output is correct |
23 |
Correct |
2 ms |
8796 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8792 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8796 KB |
Output is correct |
4 |
Correct |
2 ms |
8792 KB |
Output is correct |
5 |
Correct |
2 ms |
8796 KB |
Output is correct |
6 |
Correct |
1 ms |
8796 KB |
Output is correct |
7 |
Correct |
2 ms |
8796 KB |
Output is correct |
8 |
Correct |
1 ms |
8796 KB |
Output is correct |
9 |
Correct |
2 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8888 KB |
Output is correct |
14 |
Correct |
2 ms |
8796 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8796 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8796 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
2 ms |
8884 KB |
Output is correct |
21 |
Correct |
2 ms |
8796 KB |
Output is correct |
22 |
Correct |
3 ms |
9048 KB |
Output is correct |
23 |
Correct |
2 ms |
8796 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
25 |
Correct |
3 ms |
8792 KB |
Output is correct |
26 |
Correct |
5 ms |
9564 KB |
Output is correct |
27 |
Correct |
4 ms |
9564 KB |
Output is correct |
28 |
Correct |
4 ms |
9308 KB |
Output is correct |
29 |
Correct |
4 ms |
9304 KB |
Output is correct |
30 |
Correct |
3 ms |
9564 KB |
Output is correct |
31 |
Correct |
4 ms |
9564 KB |
Output is correct |
32 |
Correct |
3 ms |
9564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8796 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8792 KB |
Output is correct |
4 |
Correct |
2 ms |
8796 KB |
Output is correct |
5 |
Correct |
2 ms |
8792 KB |
Output is correct |
6 |
Correct |
2 ms |
8796 KB |
Output is correct |
7 |
Correct |
2 ms |
8796 KB |
Output is correct |
8 |
Correct |
1 ms |
8796 KB |
Output is correct |
9 |
Correct |
2 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8916 KB |
Output is correct |
14 |
Correct |
2 ms |
8792 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8792 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8792 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
2 ms |
8796 KB |
Output is correct |
21 |
Correct |
1 ms |
8912 KB |
Output is correct |
22 |
Correct |
2 ms |
8796 KB |
Output is correct |
23 |
Correct |
2 ms |
8796 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8796 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8792 KB |
Output is correct |
4 |
Correct |
2 ms |
8796 KB |
Output is correct |
5 |
Correct |
2 ms |
8792 KB |
Output is correct |
6 |
Correct |
2 ms |
8796 KB |
Output is correct |
7 |
Correct |
1 ms |
8796 KB |
Output is correct |
8 |
Correct |
2 ms |
8796 KB |
Output is correct |
9 |
Correct |
1 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8796 KB |
Output is correct |
14 |
Correct |
2 ms |
8888 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8796 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8796 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
1 ms |
8796 KB |
Output is correct |
21 |
Correct |
2 ms |
8796 KB |
Output is correct |
22 |
Correct |
2 ms |
8796 KB |
Output is correct |
23 |
Correct |
2 ms |
8796 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
25 |
Correct |
2 ms |
8916 KB |
Output is correct |
26 |
Correct |
2 ms |
8792 KB |
Output is correct |
27 |
Correct |
2 ms |
8796 KB |
Output is correct |
28 |
Correct |
2 ms |
8792 KB |
Output is correct |
29 |
Correct |
2 ms |
8796 KB |
Output is correct |
30 |
Correct |
2 ms |
8792 KB |
Output is correct |
31 |
Correct |
2 ms |
8796 KB |
Output is correct |
32 |
Correct |
2 ms |
8796 KB |
Output is correct |
33 |
Correct |
1 ms |
8912 KB |
Output is correct |
34 |
Correct |
2 ms |
8796 KB |
Output is correct |
35 |
Correct |
2 ms |
8796 KB |
Output is correct |
36 |
Correct |
2 ms |
8796 KB |
Output is correct |
37 |
Correct |
2 ms |
8796 KB |
Output is correct |
38 |
Correct |
2 ms |
8916 KB |
Output is correct |
39 |
Correct |
2 ms |
8796 KB |
Output is correct |
40 |
Correct |
2 ms |
8916 KB |
Output is correct |
41 |
Correct |
2 ms |
8796 KB |
Output is correct |
42 |
Correct |
2 ms |
8796 KB |
Output is correct |
43 |
Correct |
2 ms |
8796 KB |
Output is correct |
44 |
Correct |
2 ms |
8796 KB |
Output is correct |
45 |
Correct |
2 ms |
8796 KB |
Output is correct |
46 |
Correct |
2 ms |
8796 KB |
Output is correct |
47 |
Correct |
2 ms |
8792 KB |
Output is correct |
48 |
Correct |
2 ms |
8796 KB |
Output is correct |
49 |
Correct |
2 ms |
8796 KB |
Output is correct |
50 |
Correct |
1 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8796 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8792 KB |
Output is correct |
4 |
Correct |
2 ms |
8796 KB |
Output is correct |
5 |
Correct |
2 ms |
8792 KB |
Output is correct |
6 |
Correct |
2 ms |
8796 KB |
Output is correct |
7 |
Correct |
1 ms |
8796 KB |
Output is correct |
8 |
Correct |
2 ms |
8796 KB |
Output is correct |
9 |
Correct |
1 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8796 KB |
Output is correct |
14 |
Correct |
2 ms |
8888 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8796 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8796 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
2 ms |
8796 KB |
Output is correct |
21 |
Correct |
2 ms |
8884 KB |
Output is correct |
22 |
Correct |
2 ms |
8796 KB |
Output is correct |
23 |
Correct |
3 ms |
9048 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
25 |
Correct |
2 ms |
8796 KB |
Output is correct |
26 |
Correct |
2 ms |
8796 KB |
Output is correct |
27 |
Correct |
1 ms |
8796 KB |
Output is correct |
28 |
Correct |
2 ms |
8796 KB |
Output is correct |
29 |
Correct |
2 ms |
8796 KB |
Output is correct |
30 |
Correct |
2 ms |
8796 KB |
Output is correct |
31 |
Correct |
2 ms |
8796 KB |
Output is correct |
32 |
Correct |
2 ms |
8916 KB |
Output is correct |
33 |
Correct |
2 ms |
8792 KB |
Output is correct |
34 |
Correct |
2 ms |
8796 KB |
Output is correct |
35 |
Correct |
2 ms |
8792 KB |
Output is correct |
36 |
Correct |
2 ms |
8796 KB |
Output is correct |
37 |
Correct |
2 ms |
8792 KB |
Output is correct |
38 |
Correct |
2 ms |
8796 KB |
Output is correct |
39 |
Correct |
2 ms |
8796 KB |
Output is correct |
40 |
Correct |
1 ms |
8912 KB |
Output is correct |
41 |
Correct |
2 ms |
8796 KB |
Output is correct |
42 |
Correct |
2 ms |
8796 KB |
Output is correct |
43 |
Correct |
2 ms |
8796 KB |
Output is correct |
44 |
Correct |
2 ms |
8796 KB |
Output is correct |
45 |
Correct |
2 ms |
8916 KB |
Output is correct |
46 |
Correct |
2 ms |
8796 KB |
Output is correct |
47 |
Correct |
2 ms |
8916 KB |
Output is correct |
48 |
Correct |
2 ms |
8796 KB |
Output is correct |
49 |
Correct |
2 ms |
8796 KB |
Output is correct |
50 |
Correct |
2 ms |
8796 KB |
Output is correct |
51 |
Correct |
2 ms |
8796 KB |
Output is correct |
52 |
Correct |
2 ms |
8796 KB |
Output is correct |
53 |
Correct |
2 ms |
8796 KB |
Output is correct |
54 |
Correct |
2 ms |
8792 KB |
Output is correct |
55 |
Correct |
2 ms |
8796 KB |
Output is correct |
56 |
Correct |
2 ms |
8796 KB |
Output is correct |
57 |
Correct |
1 ms |
8796 KB |
Output is correct |
58 |
Correct |
2 ms |
8796 KB |
Output is correct |
59 |
Correct |
2 ms |
8796 KB |
Output is correct |
60 |
Correct |
2 ms |
8796 KB |
Output is correct |
61 |
Correct |
2 ms |
8796 KB |
Output is correct |
62 |
Correct |
2 ms |
8744 KB |
Output is correct |
63 |
Correct |
2 ms |
8796 KB |
Output is correct |
64 |
Correct |
2 ms |
8796 KB |
Output is correct |
65 |
Correct |
2 ms |
8796 KB |
Output is correct |
66 |
Correct |
2 ms |
8820 KB |
Output is correct |
67 |
Correct |
2 ms |
9048 KB |
Output is correct |
68 |
Correct |
2 ms |
8796 KB |
Output is correct |
69 |
Correct |
2 ms |
8796 KB |
Output is correct |
70 |
Correct |
2 ms |
8796 KB |
Output is correct |
71 |
Correct |
2 ms |
8796 KB |
Output is correct |
72 |
Correct |
2 ms |
8920 KB |
Output is correct |
73 |
Correct |
2 ms |
9048 KB |
Output is correct |
74 |
Correct |
3 ms |
8796 KB |
Output is correct |
75 |
Correct |
2 ms |
8796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8796 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8792 KB |
Output is correct |
4 |
Correct |
2 ms |
8796 KB |
Output is correct |
5 |
Correct |
2 ms |
8792 KB |
Output is correct |
6 |
Correct |
2 ms |
8796 KB |
Output is correct |
7 |
Correct |
1 ms |
8796 KB |
Output is correct |
8 |
Correct |
2 ms |
8796 KB |
Output is correct |
9 |
Correct |
1 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8796 KB |
Output is correct |
14 |
Correct |
2 ms |
8888 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8796 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8796 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
2 ms |
8796 KB |
Output is correct |
21 |
Correct |
2 ms |
8884 KB |
Output is correct |
22 |
Correct |
2 ms |
8796 KB |
Output is correct |
23 |
Correct |
3 ms |
9048 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
25 |
Correct |
2 ms |
8796 KB |
Output is correct |
26 |
Correct |
3 ms |
8792 KB |
Output is correct |
27 |
Correct |
5 ms |
9564 KB |
Output is correct |
28 |
Correct |
4 ms |
9564 KB |
Output is correct |
29 |
Correct |
4 ms |
9308 KB |
Output is correct |
30 |
Correct |
4 ms |
9304 KB |
Output is correct |
31 |
Correct |
3 ms |
9564 KB |
Output is correct |
32 |
Correct |
4 ms |
9564 KB |
Output is correct |
33 |
Correct |
3 ms |
9564 KB |
Output is correct |
34 |
Correct |
2 ms |
8796 KB |
Output is correct |
35 |
Correct |
1 ms |
8796 KB |
Output is correct |
36 |
Correct |
2 ms |
8796 KB |
Output is correct |
37 |
Correct |
2 ms |
8796 KB |
Output is correct |
38 |
Correct |
2 ms |
8796 KB |
Output is correct |
39 |
Correct |
2 ms |
8796 KB |
Output is correct |
40 |
Correct |
2 ms |
8916 KB |
Output is correct |
41 |
Correct |
2 ms |
8792 KB |
Output is correct |
42 |
Correct |
2 ms |
8796 KB |
Output is correct |
43 |
Correct |
2 ms |
8792 KB |
Output is correct |
44 |
Correct |
2 ms |
8796 KB |
Output is correct |
45 |
Correct |
2 ms |
8792 KB |
Output is correct |
46 |
Correct |
2 ms |
8796 KB |
Output is correct |
47 |
Correct |
2 ms |
8796 KB |
Output is correct |
48 |
Correct |
1 ms |
8912 KB |
Output is correct |
49 |
Correct |
2 ms |
8796 KB |
Output is correct |
50 |
Correct |
2 ms |
8796 KB |
Output is correct |
51 |
Correct |
2 ms |
8796 KB |
Output is correct |
52 |
Correct |
2 ms |
8796 KB |
Output is correct |
53 |
Correct |
2 ms |
8916 KB |
Output is correct |
54 |
Correct |
2 ms |
8796 KB |
Output is correct |
55 |
Correct |
2 ms |
8916 KB |
Output is correct |
56 |
Correct |
2 ms |
8796 KB |
Output is correct |
57 |
Correct |
2 ms |
8796 KB |
Output is correct |
58 |
Correct |
2 ms |
8796 KB |
Output is correct |
59 |
Correct |
2 ms |
8796 KB |
Output is correct |
60 |
Correct |
2 ms |
8796 KB |
Output is correct |
61 |
Correct |
2 ms |
8796 KB |
Output is correct |
62 |
Correct |
2 ms |
8792 KB |
Output is correct |
63 |
Correct |
2 ms |
8796 KB |
Output is correct |
64 |
Correct |
2 ms |
8796 KB |
Output is correct |
65 |
Correct |
1 ms |
8796 KB |
Output is correct |
66 |
Correct |
2 ms |
8796 KB |
Output is correct |
67 |
Correct |
2 ms |
8796 KB |
Output is correct |
68 |
Correct |
2 ms |
8796 KB |
Output is correct |
69 |
Correct |
2 ms |
8796 KB |
Output is correct |
70 |
Correct |
2 ms |
8744 KB |
Output is correct |
71 |
Correct |
2 ms |
8796 KB |
Output is correct |
72 |
Correct |
2 ms |
8796 KB |
Output is correct |
73 |
Correct |
2 ms |
8796 KB |
Output is correct |
74 |
Correct |
2 ms |
8820 KB |
Output is correct |
75 |
Correct |
2 ms |
9048 KB |
Output is correct |
76 |
Correct |
2 ms |
8796 KB |
Output is correct |
77 |
Correct |
2 ms |
8796 KB |
Output is correct |
78 |
Correct |
2 ms |
8796 KB |
Output is correct |
79 |
Correct |
2 ms |
8796 KB |
Output is correct |
80 |
Correct |
2 ms |
8920 KB |
Output is correct |
81 |
Correct |
2 ms |
9048 KB |
Output is correct |
82 |
Correct |
3 ms |
8796 KB |
Output is correct |
83 |
Correct |
2 ms |
8796 KB |
Output is correct |
84 |
Correct |
4 ms |
8796 KB |
Output is correct |
85 |
Correct |
4 ms |
9052 KB |
Output is correct |
86 |
Correct |
4 ms |
8928 KB |
Output is correct |
87 |
Correct |
4 ms |
8796 KB |
Output is correct |
88 |
Correct |
4 ms |
8972 KB |
Output is correct |
89 |
Correct |
5 ms |
9308 KB |
Output is correct |
90 |
Correct |
5 ms |
9308 KB |
Output is correct |
91 |
Correct |
5 ms |
9508 KB |
Output is correct |
92 |
Correct |
5 ms |
9308 KB |
Output is correct |
93 |
Correct |
3 ms |
9308 KB |
Output is correct |
94 |
Correct |
4 ms |
9308 KB |
Output is correct |
95 |
Correct |
4 ms |
9308 KB |
Output is correct |
96 |
Correct |
3 ms |
9308 KB |
Output is correct |
97 |
Correct |
5 ms |
9308 KB |
Output is correct |
98 |
Correct |
5 ms |
9304 KB |
Output is correct |
99 |
Correct |
5 ms |
9184 KB |
Output is correct |
100 |
Correct |
4 ms |
9052 KB |
Output is correct |
101 |
Correct |
4 ms |
9052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
8796 KB |
Output is correct |
2 |
Correct |
2 ms |
8792 KB |
Output is correct |
3 |
Correct |
2 ms |
8792 KB |
Output is correct |
4 |
Correct |
2 ms |
8796 KB |
Output is correct |
5 |
Correct |
2 ms |
8792 KB |
Output is correct |
6 |
Correct |
2 ms |
8796 KB |
Output is correct |
7 |
Correct |
1 ms |
8796 KB |
Output is correct |
8 |
Correct |
2 ms |
8796 KB |
Output is correct |
9 |
Correct |
1 ms |
8796 KB |
Output is correct |
10 |
Correct |
2 ms |
8796 KB |
Output is correct |
11 |
Correct |
2 ms |
8796 KB |
Output is correct |
12 |
Correct |
2 ms |
8796 KB |
Output is correct |
13 |
Correct |
2 ms |
8796 KB |
Output is correct |
14 |
Correct |
2 ms |
8888 KB |
Output is correct |
15 |
Correct |
2 ms |
8796 KB |
Output is correct |
16 |
Correct |
2 ms |
8796 KB |
Output is correct |
17 |
Correct |
2 ms |
8796 KB |
Output is correct |
18 |
Correct |
2 ms |
8796 KB |
Output is correct |
19 |
Correct |
2 ms |
8796 KB |
Output is correct |
20 |
Correct |
2 ms |
8796 KB |
Output is correct |
21 |
Correct |
2 ms |
8884 KB |
Output is correct |
22 |
Correct |
2 ms |
8796 KB |
Output is correct |
23 |
Correct |
3 ms |
9048 KB |
Output is correct |
24 |
Correct |
2 ms |
8796 KB |
Output is correct |
25 |
Correct |
2 ms |
8796 KB |
Output is correct |
26 |
Correct |
3 ms |
8792 KB |
Output is correct |
27 |
Correct |
5 ms |
9564 KB |
Output is correct |
28 |
Correct |
4 ms |
9564 KB |
Output is correct |
29 |
Correct |
4 ms |
9308 KB |
Output is correct |
30 |
Correct |
4 ms |
9304 KB |
Output is correct |
31 |
Correct |
3 ms |
9564 KB |
Output is correct |
32 |
Correct |
4 ms |
9564 KB |
Output is correct |
33 |
Correct |
3 ms |
9564 KB |
Output is correct |
34 |
Correct |
2 ms |
8796 KB |
Output is correct |
35 |
Correct |
1 ms |
8796 KB |
Output is correct |
36 |
Correct |
2 ms |
8796 KB |
Output is correct |
37 |
Correct |
2 ms |
8796 KB |
Output is correct |
38 |
Correct |
2 ms |
8796 KB |
Output is correct |
39 |
Correct |
2 ms |
8796 KB |
Output is correct |
40 |
Correct |
2 ms |
8916 KB |
Output is correct |
41 |
Correct |
2 ms |
8792 KB |
Output is correct |
42 |
Correct |
2 ms |
8796 KB |
Output is correct |
43 |
Correct |
2 ms |
8792 KB |
Output is correct |
44 |
Correct |
2 ms |
8796 KB |
Output is correct |
45 |
Correct |
2 ms |
8792 KB |
Output is correct |
46 |
Correct |
2 ms |
8796 KB |
Output is correct |
47 |
Correct |
2 ms |
8796 KB |
Output is correct |
48 |
Correct |
1 ms |
8912 KB |
Output is correct |
49 |
Correct |
2 ms |
8796 KB |
Output is correct |
50 |
Correct |
2 ms |
8796 KB |
Output is correct |
51 |
Correct |
2 ms |
8796 KB |
Output is correct |
52 |
Correct |
2 ms |
8796 KB |
Output is correct |
53 |
Correct |
2 ms |
8916 KB |
Output is correct |
54 |
Correct |
2 ms |
8796 KB |
Output is correct |
55 |
Correct |
2 ms |
8916 KB |
Output is correct |
56 |
Correct |
2 ms |
8796 KB |
Output is correct |
57 |
Correct |
2 ms |
8796 KB |
Output is correct |
58 |
Correct |
2 ms |
8796 KB |
Output is correct |
59 |
Correct |
2 ms |
8796 KB |
Output is correct |
60 |
Correct |
2 ms |
8796 KB |
Output is correct |
61 |
Correct |
2 ms |
8796 KB |
Output is correct |
62 |
Correct |
2 ms |
8792 KB |
Output is correct |
63 |
Correct |
2 ms |
8796 KB |
Output is correct |
64 |
Correct |
2 ms |
8796 KB |
Output is correct |
65 |
Correct |
1 ms |
8796 KB |
Output is correct |
66 |
Correct |
2 ms |
8796 KB |
Output is correct |
67 |
Correct |
2 ms |
8796 KB |
Output is correct |
68 |
Correct |
2 ms |
8796 KB |
Output is correct |
69 |
Correct |
2 ms |
8796 KB |
Output is correct |
70 |
Correct |
2 ms |
8744 KB |
Output is correct |
71 |
Correct |
2 ms |
8796 KB |
Output is correct |
72 |
Correct |
2 ms |
8796 KB |
Output is correct |
73 |
Correct |
2 ms |
8796 KB |
Output is correct |
74 |
Correct |
2 ms |
8820 KB |
Output is correct |
75 |
Correct |
2 ms |
9048 KB |
Output is correct |
76 |
Correct |
2 ms |
8796 KB |
Output is correct |
77 |
Correct |
2 ms |
8796 KB |
Output is correct |
78 |
Correct |
2 ms |
8796 KB |
Output is correct |
79 |
Correct |
2 ms |
8796 KB |
Output is correct |
80 |
Correct |
2 ms |
8920 KB |
Output is correct |
81 |
Correct |
2 ms |
9048 KB |
Output is correct |
82 |
Correct |
3 ms |
8796 KB |
Output is correct |
83 |
Correct |
2 ms |
8796 KB |
Output is correct |
84 |
Correct |
4 ms |
8796 KB |
Output is correct |
85 |
Correct |
4 ms |
9052 KB |
Output is correct |
86 |
Correct |
4 ms |
8928 KB |
Output is correct |
87 |
Correct |
4 ms |
8796 KB |
Output is correct |
88 |
Correct |
4 ms |
8972 KB |
Output is correct |
89 |
Correct |
5 ms |
9308 KB |
Output is correct |
90 |
Correct |
5 ms |
9308 KB |
Output is correct |
91 |
Correct |
5 ms |
9508 KB |
Output is correct |
92 |
Correct |
5 ms |
9308 KB |
Output is correct |
93 |
Correct |
3 ms |
9308 KB |
Output is correct |
94 |
Correct |
4 ms |
9308 KB |
Output is correct |
95 |
Correct |
4 ms |
9308 KB |
Output is correct |
96 |
Correct |
3 ms |
9308 KB |
Output is correct |
97 |
Correct |
5 ms |
9308 KB |
Output is correct |
98 |
Correct |
5 ms |
9304 KB |
Output is correct |
99 |
Correct |
5 ms |
9184 KB |
Output is correct |
100 |
Correct |
4 ms |
9052 KB |
Output is correct |
101 |
Correct |
4 ms |
9052 KB |
Output is correct |
102 |
Correct |
126 ms |
13904 KB |
Output is correct |
103 |
Correct |
140 ms |
14176 KB |
Output is correct |
104 |
Correct |
309 ms |
53320 KB |
Output is correct |
105 |
Correct |
178 ms |
13976 KB |
Output is correct |
106 |
Correct |
225 ms |
14620 KB |
Output is correct |
107 |
Correct |
113 ms |
36056 KB |
Output is correct |
108 |
Correct |
111 ms |
35620 KB |
Output is correct |
109 |
Correct |
92 ms |
46364 KB |
Output is correct |
110 |
Correct |
394 ms |
40172 KB |
Output is correct |
111 |
Correct |
203 ms |
45844 KB |
Output is correct |
112 |
Correct |
314 ms |
38364 KB |
Output is correct |
113 |
Correct |
217 ms |
37768 KB |
Output is correct |
114 |
Correct |
350 ms |
34176 KB |
Output is correct |
115 |
Correct |
139 ms |
45536 KB |
Output is correct |
116 |
Correct |
305 ms |
43844 KB |
Output is correct |
117 |
Correct |
206 ms |
45452 KB |
Output is correct |
118 |
Correct |
383 ms |
38452 KB |
Output is correct |
119 |
Correct |
181 ms |
15652 KB |
Output is correct |
120 |
Correct |
134 ms |
11616 KB |
Output is correct |