#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'
using namespace std;
typedef long long ll;
const int mx=3e3+12;
const int mxn=2e5+12;
vector<pair<int,ll>> g[mxn];
vector<int> ord;
ll dp[4][mx][mx*2];
int sz2[mx];
ll cost1[mxn];
ll cost2[mxn];
ll tmp[4][mx*2];
bool is[mx];
int sz[mx];
ll n,k,x,y;
void init(){
ord.clear();
for(int i=0;i<n+10;i++){
g[i].clear();
cost1[i]=cost2[i]=0;
is[i]=sz[i]=0;
sz2[i]=0;
tmp[0][i]=tmp[1][i]=tmp[2][i]=1e18+1;
for(int j=0;j<n*2+10;j++){
dp[0][i][j]=dp[1][i][j]=dp[2][i][j]=dp[3][i][j]=1e18+1;
}
}
}
int calc(){
vector<ll> a,b;
int ans=0;
for(int i=0;i<n;i++){
a.push_back(cost1[i]);
b.push_back(cost2[i]);
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
for(int i=1;i<n;i++){
a[i]+=a[i-1];
}
for(int i=1;i<n;i++){
b[i]+=b[i-1];
}
for(int i=0;i<n;i++){
if(a[i]<=k || b[i]<=k){
ans=max(ans,i+1);
}
}
for(int i=n-1,j=-1;i>=0;i--){
while(j<n-1 && b[j+1]+a[i]<=k){
j++;
}
if(j!=-1){
ans=max(ans,i+j+2);
}
}
return ans;
}
void calc(int v,int p,ll d[]){
for(auto [to,w]:g[v]){
if(to!=p){
d[to]=d[v]+w;
calc(to,v,d);
}
}
}
bool path(int v,int p,int f){
if(v==f){
ord.push_back(v);
is[v]=1;
return 1;
}
for(auto [to,w]:g[v]){
if(to!=p && path(to,v,f)){
ord.push_back(v);
is[v]=1;
return 1;
}
}
return 0;
}
void dfs(int v,int p){
dp[0][v][0]=0;
dp[1][v][1]=cost1[v];
dp[2][v][1]=cost2[v];
dp[3][v][2]=max(cost1[v],cost2[v]);
sz[v]=1;
for(auto [to,w]:g[v]){
if(to==p || is[to])continue;
dfs(to,v);
for(int m=0;m<4;m++){
for(int i=0;i<=n*2;i++){
tmp[m][i]=dp[m][v][i];
}
}
for(int m=0;m<4;m++){
for(int m1=m;m1>=0;m1=((m1-1)&m)){
for(int x=1;x<=sz[v]*2;x++){
for(int y=0;y<=sz[to]*2;y++){
tmp[m][x+y]=min(tmp[m][x+y],dp[m][v][x]+dp[m1][to][y]);
}
}
if(!m1)break;
}
}
for(int m=0;m<4;m++){
for(int i=0;i<=n*2;i++){
dp[m][v][i]=tmp[m][i];
}
}
sz[v]+=sz[to];
}
}
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,k=K,x=X,y=Y;
if(n>3e3){
for(int i=0;i<n;i++){
cost1[i]=cost2[i]=0;
g[i].clear();
}
for(int i=0;i<n-1;i++){
g[V[i]].push_back({U[i],W[i]});
g[U[i]].push_back({V[i],W[i]});
}
calc(x,-1,cost1);
calc(y,-1,cost2);
return calc();
}
init();
for(int i=0;i<n-1;i++){
g[V[i]].push_back({U[i],W[i]});
g[U[i]].push_back({V[i],W[i]});
}
calc(x,-1,cost1);
calc(y,-1,cost2);
int ans=calc();
path(y,-1,x);
for(int i=ord.size()-1;i>=0;i--){
dfs(ord[i],-1);
}
for(int i=0;i<n;i++){
sz2[i]=sz[i];
}
for(int i=ord.size()-2;i>=0;i--){
int v=ord[i],u=ord[i+1];
for(int m=2;m<4;m++){
for(int i=0;i<n*2+10;i++){
tmp[m][i]=1e18+1;
}
}
for(int m=2;m<4;m++){
for(int m1=m;m1>1;m1=((m1-1)&m)){
for(int x=1;x<=sz[v]*2;x++){
for(int y=1;y<=sz[u]*2;y++){
tmp[m][x+y]=min(tmp[m][x+y],dp[m][v][x]+dp[m1][u][y]);
}
}
}
}
for(int m=2;m<4;m++){
for(int i=0;i<n*2+10;i++){
dp[m][v][i]=tmp[m][i];
}
}
sz[v]+=sz[u];
}
for(int i=0;i<ord.size()-1;i++){
int u=ord[i],v=ord[i+1];
for(int m=0;m<2;m++){
for(int i=0;i<n*2+10;i++){
tmp[m][i]=1e18+1;
}
}
int m=1,m1=1;
for(int x=1;x<=sz2[v]*2;x++){
for(int y=1;y<=sz2[u]*2;y++){
tmp[m][x+y]=min(tmp[m][x+y],dp[m][v][x]+dp[m1][u][y]);
}
}
for(int m=1;m<2;m++){
for(int i=0;i<n*2+10;i++){
dp[m][v][i]=tmp[m][i];
}
}
sz2[v]+=sz2[u];
}
for(int i=0;i<n;i++){
for(int j=n*2-1;j>=0;j--){
dp[3][i][j]=min(dp[3][i][j+1],dp[3][i][j]);
dp[1][i][j]=min(dp[1][i][j+1],dp[1][i][j]);
}
}
for(int i=0;i<n;i++){
for(int j=0;j<=n*2;j++){
if(dp[3][x][j]<=k){
ans=max(ans,j);
}
}
}
for(int i=0;i<ord.size()-1;i++){
int v=ord[i],u=ord[i+1];
int j=0;
for(int i=n*2;i>=0;i--){
while(j<n*2 && dp[3][u][j+1]+dp[1][v][i]<=k){
j++;
}
if(dp[3][u][j]+dp[1][v][i]<=k){
ans=max(ans,i+j);
}
}
}
return ans;
}
Compilation message
closing.cpp: In function 'void init()':
closing.cpp:27:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
27 | is[i]=sz[i]=0;
| ~~~~~^~
closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:178:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
178 | for(int i=0;i<ord.size()-1;i++){
| ~^~~~~~~~~~~~~
closing.cpp:211:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
211 | for(int i=0;i<ord.size()-1;i++){
| ~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
121 ms |
32756 KB |
Output is correct |
2 |
Correct |
133 ms |
41404 KB |
Output is correct |
3 |
Execution timed out |
1034 ms |
212500 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
4 ms |
22380 KB |
Output is correct |
3 |
Correct |
4 ms |
22364 KB |
Output is correct |
4 |
Correct |
4 ms |
22388 KB |
Output is correct |
5 |
Correct |
4 ms |
22364 KB |
Output is correct |
6 |
Correct |
5 ms |
28508 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
4 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
5 ms |
28508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
4 ms |
22380 KB |
Output is correct |
3 |
Correct |
4 ms |
22364 KB |
Output is correct |
4 |
Correct |
4 ms |
22388 KB |
Output is correct |
5 |
Correct |
4 ms |
22364 KB |
Output is correct |
6 |
Correct |
5 ms |
28508 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
4 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
5 ms |
28508 KB |
Output is correct |
12 |
Correct |
5 ms |
38748 KB |
Output is correct |
13 |
Correct |
6 ms |
38748 KB |
Output is correct |
14 |
Correct |
5 ms |
36700 KB |
Output is correct |
15 |
Correct |
6 ms |
36700 KB |
Output is correct |
16 |
Correct |
6 ms |
38748 KB |
Output is correct |
17 |
Correct |
6 ms |
38748 KB |
Output is correct |
18 |
Correct |
4 ms |
22364 KB |
Output is correct |
19 |
Correct |
22 ms |
112732 KB |
Output is correct |
20 |
Correct |
20 ms |
104628 KB |
Output is correct |
21 |
Correct |
20 ms |
108632 KB |
Output is correct |
22 |
Correct |
21 ms |
112732 KB |
Output is correct |
23 |
Correct |
24 ms |
113004 KB |
Output is correct |
24 |
Correct |
21 ms |
112724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
4 ms |
22380 KB |
Output is correct |
3 |
Correct |
4 ms |
22364 KB |
Output is correct |
4 |
Correct |
4 ms |
22388 KB |
Output is correct |
5 |
Correct |
4 ms |
22364 KB |
Output is correct |
6 |
Correct |
5 ms |
28508 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
4 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
5 ms |
28508 KB |
Output is correct |
12 |
Correct |
5 ms |
38748 KB |
Output is correct |
13 |
Correct |
6 ms |
38748 KB |
Output is correct |
14 |
Correct |
5 ms |
36700 KB |
Output is correct |
15 |
Correct |
6 ms |
36700 KB |
Output is correct |
16 |
Correct |
6 ms |
38748 KB |
Output is correct |
17 |
Correct |
6 ms |
38748 KB |
Output is correct |
18 |
Correct |
4 ms |
22364 KB |
Output is correct |
19 |
Correct |
22 ms |
112732 KB |
Output is correct |
20 |
Correct |
20 ms |
104628 KB |
Output is correct |
21 |
Correct |
20 ms |
108632 KB |
Output is correct |
22 |
Correct |
21 ms |
112732 KB |
Output is correct |
23 |
Correct |
24 ms |
113004 KB |
Output is correct |
24 |
Correct |
21 ms |
112724 KB |
Output is correct |
25 |
Correct |
9 ms |
28504 KB |
Output is correct |
26 |
Correct |
384 ms |
575076 KB |
Output is correct |
27 |
Correct |
336 ms |
539580 KB |
Output is correct |
28 |
Correct |
360 ms |
543060 KB |
Output is correct |
29 |
Correct |
381 ms |
564584 KB |
Output is correct |
30 |
Correct |
330 ms |
536912 KB |
Output is correct |
31 |
Correct |
396 ms |
575076 KB |
Output is correct |
32 |
Correct |
388 ms |
575056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
3 ms |
20316 KB |
Output is correct |
3 |
Correct |
4 ms |
22380 KB |
Output is correct |
4 |
Correct |
4 ms |
22364 KB |
Output is correct |
5 |
Correct |
4 ms |
22388 KB |
Output is correct |
6 |
Correct |
4 ms |
22364 KB |
Output is correct |
7 |
Correct |
3 ms |
20312 KB |
Output is correct |
8 |
Correct |
3 ms |
20316 KB |
Output is correct |
9 |
Correct |
4 ms |
20316 KB |
Output is correct |
10 |
Correct |
4 ms |
22364 KB |
Output is correct |
11 |
Correct |
3 ms |
22364 KB |
Output is correct |
12 |
Correct |
4 ms |
22364 KB |
Output is correct |
13 |
Correct |
4 ms |
22364 KB |
Output is correct |
14 |
Correct |
4 ms |
22364 KB |
Output is correct |
15 |
Correct |
4 ms |
22364 KB |
Output is correct |
16 |
Correct |
4 ms |
22364 KB |
Output is correct |
17 |
Correct |
3 ms |
22376 KB |
Output is correct |
18 |
Correct |
4 ms |
22364 KB |
Output is correct |
19 |
Correct |
3 ms |
22364 KB |
Output is correct |
20 |
Correct |
4 ms |
22364 KB |
Output is correct |
21 |
Correct |
4 ms |
22364 KB |
Output is correct |
22 |
Correct |
4 ms |
22364 KB |
Output is correct |
23 |
Correct |
3 ms |
22168 KB |
Output is correct |
24 |
Correct |
4 ms |
22364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
3 ms |
20316 KB |
Output is correct |
3 |
Correct |
4 ms |
22380 KB |
Output is correct |
4 |
Correct |
4 ms |
22364 KB |
Output is correct |
5 |
Correct |
4 ms |
22388 KB |
Output is correct |
6 |
Correct |
4 ms |
22364 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
5 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
4 ms |
28508 KB |
Output is correct |
12 |
Correct |
5 ms |
28508 KB |
Output is correct |
13 |
Correct |
5 ms |
38748 KB |
Output is correct |
14 |
Correct |
6 ms |
38748 KB |
Output is correct |
15 |
Correct |
5 ms |
36700 KB |
Output is correct |
16 |
Correct |
6 ms |
36700 KB |
Output is correct |
17 |
Correct |
6 ms |
38748 KB |
Output is correct |
18 |
Correct |
6 ms |
38748 KB |
Output is correct |
19 |
Correct |
3 ms |
20312 KB |
Output is correct |
20 |
Correct |
3 ms |
20316 KB |
Output is correct |
21 |
Correct |
4 ms |
20316 KB |
Output is correct |
22 |
Correct |
4 ms |
22364 KB |
Output is correct |
23 |
Correct |
3 ms |
22364 KB |
Output is correct |
24 |
Correct |
4 ms |
22364 KB |
Output is correct |
25 |
Correct |
4 ms |
22364 KB |
Output is correct |
26 |
Correct |
4 ms |
22364 KB |
Output is correct |
27 |
Correct |
4 ms |
22364 KB |
Output is correct |
28 |
Correct |
4 ms |
22364 KB |
Output is correct |
29 |
Correct |
3 ms |
22376 KB |
Output is correct |
30 |
Correct |
4 ms |
22364 KB |
Output is correct |
31 |
Correct |
3 ms |
22364 KB |
Output is correct |
32 |
Correct |
4 ms |
22364 KB |
Output is correct |
33 |
Correct |
4 ms |
22364 KB |
Output is correct |
34 |
Correct |
4 ms |
22364 KB |
Output is correct |
35 |
Correct |
3 ms |
22168 KB |
Output is correct |
36 |
Correct |
4 ms |
22364 KB |
Output is correct |
37 |
Correct |
4 ms |
22360 KB |
Output is correct |
38 |
Correct |
4 ms |
26488 KB |
Output is correct |
39 |
Correct |
6 ms |
38748 KB |
Output is correct |
40 |
Correct |
6 ms |
36700 KB |
Output is correct |
41 |
Correct |
6 ms |
38748 KB |
Output is correct |
42 |
Correct |
5 ms |
36700 KB |
Output is correct |
43 |
Correct |
5 ms |
36700 KB |
Output is correct |
44 |
Correct |
5 ms |
36700 KB |
Output is correct |
45 |
Correct |
6 ms |
38748 KB |
Output is correct |
46 |
Correct |
6 ms |
39000 KB |
Output is correct |
47 |
Correct |
6 ms |
38748 KB |
Output is correct |
48 |
Correct |
5 ms |
34648 KB |
Output is correct |
49 |
Correct |
5 ms |
30556 KB |
Output is correct |
50 |
Correct |
3 ms |
22368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
3 ms |
20316 KB |
Output is correct |
3 |
Correct |
4 ms |
22380 KB |
Output is correct |
4 |
Correct |
4 ms |
22364 KB |
Output is correct |
5 |
Correct |
4 ms |
22388 KB |
Output is correct |
6 |
Correct |
4 ms |
22364 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
5 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
4 ms |
28508 KB |
Output is correct |
12 |
Correct |
5 ms |
28508 KB |
Output is correct |
13 |
Correct |
5 ms |
38748 KB |
Output is correct |
14 |
Correct |
6 ms |
38748 KB |
Output is correct |
15 |
Correct |
5 ms |
36700 KB |
Output is correct |
16 |
Correct |
6 ms |
36700 KB |
Output is correct |
17 |
Correct |
6 ms |
38748 KB |
Output is correct |
18 |
Correct |
6 ms |
38748 KB |
Output is correct |
19 |
Correct |
4 ms |
22364 KB |
Output is correct |
20 |
Correct |
22 ms |
112732 KB |
Output is correct |
21 |
Correct |
20 ms |
104628 KB |
Output is correct |
22 |
Correct |
20 ms |
108632 KB |
Output is correct |
23 |
Correct |
21 ms |
112732 KB |
Output is correct |
24 |
Correct |
24 ms |
113004 KB |
Output is correct |
25 |
Correct |
21 ms |
112724 KB |
Output is correct |
26 |
Correct |
3 ms |
20312 KB |
Output is correct |
27 |
Correct |
3 ms |
20316 KB |
Output is correct |
28 |
Correct |
4 ms |
20316 KB |
Output is correct |
29 |
Correct |
4 ms |
22364 KB |
Output is correct |
30 |
Correct |
3 ms |
22364 KB |
Output is correct |
31 |
Correct |
4 ms |
22364 KB |
Output is correct |
32 |
Correct |
4 ms |
22364 KB |
Output is correct |
33 |
Correct |
4 ms |
22364 KB |
Output is correct |
34 |
Correct |
4 ms |
22364 KB |
Output is correct |
35 |
Correct |
4 ms |
22364 KB |
Output is correct |
36 |
Correct |
3 ms |
22376 KB |
Output is correct |
37 |
Correct |
4 ms |
22364 KB |
Output is correct |
38 |
Correct |
3 ms |
22364 KB |
Output is correct |
39 |
Correct |
4 ms |
22364 KB |
Output is correct |
40 |
Correct |
4 ms |
22364 KB |
Output is correct |
41 |
Correct |
4 ms |
22364 KB |
Output is correct |
42 |
Correct |
3 ms |
22168 KB |
Output is correct |
43 |
Correct |
4 ms |
22364 KB |
Output is correct |
44 |
Correct |
4 ms |
22360 KB |
Output is correct |
45 |
Correct |
4 ms |
26488 KB |
Output is correct |
46 |
Correct |
6 ms |
38748 KB |
Output is correct |
47 |
Correct |
6 ms |
36700 KB |
Output is correct |
48 |
Correct |
6 ms |
38748 KB |
Output is correct |
49 |
Correct |
5 ms |
36700 KB |
Output is correct |
50 |
Correct |
5 ms |
36700 KB |
Output is correct |
51 |
Correct |
5 ms |
36700 KB |
Output is correct |
52 |
Correct |
6 ms |
38748 KB |
Output is correct |
53 |
Correct |
6 ms |
39000 KB |
Output is correct |
54 |
Correct |
6 ms |
38748 KB |
Output is correct |
55 |
Correct |
5 ms |
34648 KB |
Output is correct |
56 |
Correct |
5 ms |
30556 KB |
Output is correct |
57 |
Correct |
3 ms |
22368 KB |
Output is correct |
58 |
Correct |
4 ms |
24412 KB |
Output is correct |
59 |
Correct |
6 ms |
36728 KB |
Output is correct |
60 |
Correct |
7 ms |
38748 KB |
Output is correct |
61 |
Correct |
8 ms |
46940 KB |
Output is correct |
62 |
Correct |
8 ms |
47000 KB |
Output is correct |
63 |
Correct |
22 ms |
112732 KB |
Output is correct |
64 |
Correct |
19 ms |
106588 KB |
Output is correct |
65 |
Correct |
18 ms |
104328 KB |
Output is correct |
66 |
Correct |
19 ms |
106388 KB |
Output is correct |
67 |
Correct |
20 ms |
112624 KB |
Output is correct |
68 |
Correct |
19 ms |
104536 KB |
Output is correct |
69 |
Correct |
20 ms |
112696 KB |
Output is correct |
70 |
Correct |
19 ms |
108632 KB |
Output is correct |
71 |
Correct |
18 ms |
108636 KB |
Output is correct |
72 |
Correct |
18 ms |
110596 KB |
Output is correct |
73 |
Correct |
16 ms |
91996 KB |
Output is correct |
74 |
Correct |
17 ms |
96088 KB |
Output is correct |
75 |
Correct |
7 ms |
38748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
3 ms |
20316 KB |
Output is correct |
3 |
Correct |
4 ms |
22380 KB |
Output is correct |
4 |
Correct |
4 ms |
22364 KB |
Output is correct |
5 |
Correct |
4 ms |
22388 KB |
Output is correct |
6 |
Correct |
4 ms |
22364 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
5 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
4 ms |
28508 KB |
Output is correct |
12 |
Correct |
5 ms |
28508 KB |
Output is correct |
13 |
Correct |
5 ms |
38748 KB |
Output is correct |
14 |
Correct |
6 ms |
38748 KB |
Output is correct |
15 |
Correct |
5 ms |
36700 KB |
Output is correct |
16 |
Correct |
6 ms |
36700 KB |
Output is correct |
17 |
Correct |
6 ms |
38748 KB |
Output is correct |
18 |
Correct |
6 ms |
38748 KB |
Output is correct |
19 |
Correct |
4 ms |
22364 KB |
Output is correct |
20 |
Correct |
22 ms |
112732 KB |
Output is correct |
21 |
Correct |
20 ms |
104628 KB |
Output is correct |
22 |
Correct |
20 ms |
108632 KB |
Output is correct |
23 |
Correct |
21 ms |
112732 KB |
Output is correct |
24 |
Correct |
24 ms |
113004 KB |
Output is correct |
25 |
Correct |
21 ms |
112724 KB |
Output is correct |
26 |
Correct |
9 ms |
28504 KB |
Output is correct |
27 |
Correct |
384 ms |
575076 KB |
Output is correct |
28 |
Correct |
336 ms |
539580 KB |
Output is correct |
29 |
Correct |
360 ms |
543060 KB |
Output is correct |
30 |
Correct |
381 ms |
564584 KB |
Output is correct |
31 |
Correct |
330 ms |
536912 KB |
Output is correct |
32 |
Correct |
396 ms |
575076 KB |
Output is correct |
33 |
Correct |
388 ms |
575056 KB |
Output is correct |
34 |
Correct |
3 ms |
20312 KB |
Output is correct |
35 |
Correct |
3 ms |
20316 KB |
Output is correct |
36 |
Correct |
4 ms |
20316 KB |
Output is correct |
37 |
Correct |
4 ms |
22364 KB |
Output is correct |
38 |
Correct |
3 ms |
22364 KB |
Output is correct |
39 |
Correct |
4 ms |
22364 KB |
Output is correct |
40 |
Correct |
4 ms |
22364 KB |
Output is correct |
41 |
Correct |
4 ms |
22364 KB |
Output is correct |
42 |
Correct |
4 ms |
22364 KB |
Output is correct |
43 |
Correct |
4 ms |
22364 KB |
Output is correct |
44 |
Correct |
3 ms |
22376 KB |
Output is correct |
45 |
Correct |
4 ms |
22364 KB |
Output is correct |
46 |
Correct |
3 ms |
22364 KB |
Output is correct |
47 |
Correct |
4 ms |
22364 KB |
Output is correct |
48 |
Correct |
4 ms |
22364 KB |
Output is correct |
49 |
Correct |
4 ms |
22364 KB |
Output is correct |
50 |
Correct |
3 ms |
22168 KB |
Output is correct |
51 |
Correct |
4 ms |
22364 KB |
Output is correct |
52 |
Correct |
4 ms |
22360 KB |
Output is correct |
53 |
Correct |
4 ms |
26488 KB |
Output is correct |
54 |
Correct |
6 ms |
38748 KB |
Output is correct |
55 |
Correct |
6 ms |
36700 KB |
Output is correct |
56 |
Correct |
6 ms |
38748 KB |
Output is correct |
57 |
Correct |
5 ms |
36700 KB |
Output is correct |
58 |
Correct |
5 ms |
36700 KB |
Output is correct |
59 |
Correct |
5 ms |
36700 KB |
Output is correct |
60 |
Correct |
6 ms |
38748 KB |
Output is correct |
61 |
Correct |
6 ms |
39000 KB |
Output is correct |
62 |
Correct |
6 ms |
38748 KB |
Output is correct |
63 |
Correct |
5 ms |
34648 KB |
Output is correct |
64 |
Correct |
5 ms |
30556 KB |
Output is correct |
65 |
Correct |
3 ms |
22368 KB |
Output is correct |
66 |
Correct |
4 ms |
24412 KB |
Output is correct |
67 |
Correct |
6 ms |
36728 KB |
Output is correct |
68 |
Correct |
7 ms |
38748 KB |
Output is correct |
69 |
Correct |
8 ms |
46940 KB |
Output is correct |
70 |
Correct |
8 ms |
47000 KB |
Output is correct |
71 |
Correct |
22 ms |
112732 KB |
Output is correct |
72 |
Correct |
19 ms |
106588 KB |
Output is correct |
73 |
Correct |
18 ms |
104328 KB |
Output is correct |
74 |
Correct |
19 ms |
106388 KB |
Output is correct |
75 |
Correct |
20 ms |
112624 KB |
Output is correct |
76 |
Correct |
19 ms |
104536 KB |
Output is correct |
77 |
Correct |
20 ms |
112696 KB |
Output is correct |
78 |
Correct |
19 ms |
108632 KB |
Output is correct |
79 |
Correct |
18 ms |
108636 KB |
Output is correct |
80 |
Correct |
18 ms |
110596 KB |
Output is correct |
81 |
Correct |
16 ms |
91996 KB |
Output is correct |
82 |
Correct |
17 ms |
96088 KB |
Output is correct |
83 |
Correct |
7 ms |
38748 KB |
Output is correct |
84 |
Correct |
9 ms |
28508 KB |
Output is correct |
85 |
Correct |
30 ms |
71772 KB |
Output is correct |
86 |
Correct |
14 ms |
38744 KB |
Output is correct |
87 |
Correct |
17 ms |
46936 KB |
Output is correct |
88 |
Correct |
17 ms |
46940 KB |
Output is correct |
89 |
Correct |
407 ms |
575068 KB |
Output is correct |
90 |
Correct |
334 ms |
521360 KB |
Output is correct |
91 |
Correct |
361 ms |
574740 KB |
Output is correct |
92 |
Correct |
355 ms |
538196 KB |
Output is correct |
93 |
Correct |
310 ms |
543932 KB |
Output is correct |
94 |
Correct |
364 ms |
551928 KB |
Output is correct |
95 |
Correct |
378 ms |
565332 KB |
Output is correct |
96 |
Correct |
315 ms |
527108 KB |
Output is correct |
97 |
Correct |
350 ms |
563932 KB |
Output is correct |
98 |
Correct |
336 ms |
556636 KB |
Output is correct |
99 |
Correct |
408 ms |
574884 KB |
Output is correct |
100 |
Correct |
216 ms |
362544 KB |
Output is correct |
101 |
Correct |
48 ms |
112728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
20316 KB |
Output is correct |
2 |
Correct |
3 ms |
20316 KB |
Output is correct |
3 |
Correct |
4 ms |
22380 KB |
Output is correct |
4 |
Correct |
4 ms |
22364 KB |
Output is correct |
5 |
Correct |
4 ms |
22388 KB |
Output is correct |
6 |
Correct |
4 ms |
22364 KB |
Output is correct |
7 |
Correct |
5 ms |
28508 KB |
Output is correct |
8 |
Correct |
5 ms |
28508 KB |
Output is correct |
9 |
Correct |
5 ms |
28508 KB |
Output is correct |
10 |
Correct |
4 ms |
28508 KB |
Output is correct |
11 |
Correct |
4 ms |
28508 KB |
Output is correct |
12 |
Correct |
5 ms |
28508 KB |
Output is correct |
13 |
Correct |
5 ms |
38748 KB |
Output is correct |
14 |
Correct |
6 ms |
38748 KB |
Output is correct |
15 |
Correct |
5 ms |
36700 KB |
Output is correct |
16 |
Correct |
6 ms |
36700 KB |
Output is correct |
17 |
Correct |
6 ms |
38748 KB |
Output is correct |
18 |
Correct |
6 ms |
38748 KB |
Output is correct |
19 |
Correct |
4 ms |
22364 KB |
Output is correct |
20 |
Correct |
22 ms |
112732 KB |
Output is correct |
21 |
Correct |
20 ms |
104628 KB |
Output is correct |
22 |
Correct |
20 ms |
108632 KB |
Output is correct |
23 |
Correct |
21 ms |
112732 KB |
Output is correct |
24 |
Correct |
24 ms |
113004 KB |
Output is correct |
25 |
Correct |
21 ms |
112724 KB |
Output is correct |
26 |
Correct |
9 ms |
28504 KB |
Output is correct |
27 |
Correct |
384 ms |
575076 KB |
Output is correct |
28 |
Correct |
336 ms |
539580 KB |
Output is correct |
29 |
Correct |
360 ms |
543060 KB |
Output is correct |
30 |
Correct |
381 ms |
564584 KB |
Output is correct |
31 |
Correct |
330 ms |
536912 KB |
Output is correct |
32 |
Correct |
396 ms |
575076 KB |
Output is correct |
33 |
Correct |
388 ms |
575056 KB |
Output is correct |
34 |
Correct |
3 ms |
20312 KB |
Output is correct |
35 |
Correct |
3 ms |
20316 KB |
Output is correct |
36 |
Correct |
4 ms |
20316 KB |
Output is correct |
37 |
Correct |
4 ms |
22364 KB |
Output is correct |
38 |
Correct |
3 ms |
22364 KB |
Output is correct |
39 |
Correct |
4 ms |
22364 KB |
Output is correct |
40 |
Correct |
4 ms |
22364 KB |
Output is correct |
41 |
Correct |
4 ms |
22364 KB |
Output is correct |
42 |
Correct |
4 ms |
22364 KB |
Output is correct |
43 |
Correct |
4 ms |
22364 KB |
Output is correct |
44 |
Correct |
3 ms |
22376 KB |
Output is correct |
45 |
Correct |
4 ms |
22364 KB |
Output is correct |
46 |
Correct |
3 ms |
22364 KB |
Output is correct |
47 |
Correct |
4 ms |
22364 KB |
Output is correct |
48 |
Correct |
4 ms |
22364 KB |
Output is correct |
49 |
Correct |
4 ms |
22364 KB |
Output is correct |
50 |
Correct |
3 ms |
22168 KB |
Output is correct |
51 |
Correct |
4 ms |
22364 KB |
Output is correct |
52 |
Correct |
4 ms |
22360 KB |
Output is correct |
53 |
Correct |
4 ms |
26488 KB |
Output is correct |
54 |
Correct |
6 ms |
38748 KB |
Output is correct |
55 |
Correct |
6 ms |
36700 KB |
Output is correct |
56 |
Correct |
6 ms |
38748 KB |
Output is correct |
57 |
Correct |
5 ms |
36700 KB |
Output is correct |
58 |
Correct |
5 ms |
36700 KB |
Output is correct |
59 |
Correct |
5 ms |
36700 KB |
Output is correct |
60 |
Correct |
6 ms |
38748 KB |
Output is correct |
61 |
Correct |
6 ms |
39000 KB |
Output is correct |
62 |
Correct |
6 ms |
38748 KB |
Output is correct |
63 |
Correct |
5 ms |
34648 KB |
Output is correct |
64 |
Correct |
5 ms |
30556 KB |
Output is correct |
65 |
Correct |
3 ms |
22368 KB |
Output is correct |
66 |
Correct |
4 ms |
24412 KB |
Output is correct |
67 |
Correct |
6 ms |
36728 KB |
Output is correct |
68 |
Correct |
7 ms |
38748 KB |
Output is correct |
69 |
Correct |
8 ms |
46940 KB |
Output is correct |
70 |
Correct |
8 ms |
47000 KB |
Output is correct |
71 |
Correct |
22 ms |
112732 KB |
Output is correct |
72 |
Correct |
19 ms |
106588 KB |
Output is correct |
73 |
Correct |
18 ms |
104328 KB |
Output is correct |
74 |
Correct |
19 ms |
106388 KB |
Output is correct |
75 |
Correct |
20 ms |
112624 KB |
Output is correct |
76 |
Correct |
19 ms |
104536 KB |
Output is correct |
77 |
Correct |
20 ms |
112696 KB |
Output is correct |
78 |
Correct |
19 ms |
108632 KB |
Output is correct |
79 |
Correct |
18 ms |
108636 KB |
Output is correct |
80 |
Correct |
18 ms |
110596 KB |
Output is correct |
81 |
Correct |
16 ms |
91996 KB |
Output is correct |
82 |
Correct |
17 ms |
96088 KB |
Output is correct |
83 |
Correct |
7 ms |
38748 KB |
Output is correct |
84 |
Correct |
9 ms |
28508 KB |
Output is correct |
85 |
Correct |
30 ms |
71772 KB |
Output is correct |
86 |
Correct |
14 ms |
38744 KB |
Output is correct |
87 |
Correct |
17 ms |
46936 KB |
Output is correct |
88 |
Correct |
17 ms |
46940 KB |
Output is correct |
89 |
Correct |
407 ms |
575068 KB |
Output is correct |
90 |
Correct |
334 ms |
521360 KB |
Output is correct |
91 |
Correct |
361 ms |
574740 KB |
Output is correct |
92 |
Correct |
355 ms |
538196 KB |
Output is correct |
93 |
Correct |
310 ms |
543932 KB |
Output is correct |
94 |
Correct |
364 ms |
551928 KB |
Output is correct |
95 |
Correct |
378 ms |
565332 KB |
Output is correct |
96 |
Correct |
315 ms |
527108 KB |
Output is correct |
97 |
Correct |
350 ms |
563932 KB |
Output is correct |
98 |
Correct |
336 ms |
556636 KB |
Output is correct |
99 |
Correct |
408 ms |
574884 KB |
Output is correct |
100 |
Correct |
216 ms |
362544 KB |
Output is correct |
101 |
Correct |
48 ms |
112728 KB |
Output is correct |
102 |
Correct |
505 ms |
41464 KB |
Output is correct |
103 |
Execution timed out |
1040 ms |
96720 KB |
Time limit exceeded |
104 |
Halted |
0 ms |
0 KB |
- |