#include "swap.h"
#include<bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
using namespace std;
int l,r,i,j,ii,jj,k,n,m,mx,subtask=1;
vector< pair<int,int> > v[100000];
set< pair<int,int> > st;
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
n=N;
m=M;
for(i=0;i<M;i++){
v[U[i]].pb({V[i],W[i]});
v[V[i]].pb({U[i],W[i]});
mx=max(mx,W[i]);
st.insert({W[i],V[i]});
}
for(i=0;i<n;i++) if(v[i].size()>2) subtask=2;
}
int getMinimumFuelCapacity(int X, int Y) {
if(subtask==1){
if(n>m) return -1;
else return mx;
}
if(X==0 || Y==0) return -1;
st.erase({v[X][0].ss,X});
st.erase({v[Y][0].ss,Y});
mx=max(v[X][0].ss,v[Y][0].ss);
mx=max(mx,(*st.begin()).ff);
st.insert({v[X][0].ss,X});
st.insert({v[Y][0].ss,Y});
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2648 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2660 KB |
Output is correct |
6 |
Correct |
3 ms |
2664 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
3 ms |
2772 KB |
Output is correct |
9 |
Correct |
71 ms |
11628 KB |
Output is correct |
10 |
Correct |
108 ms |
13328 KB |
Output is correct |
11 |
Correct |
105 ms |
13204 KB |
Output is correct |
12 |
Correct |
126 ms |
13732 KB |
Output is correct |
13 |
Correct |
100 ms |
13828 KB |
Output is correct |
14 |
Correct |
88 ms |
11728 KB |
Output is correct |
15 |
Correct |
158 ms |
15320 KB |
Output is correct |
16 |
Correct |
171 ms |
15000 KB |
Output is correct |
17 |
Correct |
150 ms |
15624 KB |
Output is correct |
18 |
Correct |
176 ms |
15568 KB |
Output is correct |
19 |
Correct |
55 ms |
8692 KB |
Output is correct |
20 |
Correct |
162 ms |
16372 KB |
Output is correct |
21 |
Correct |
160 ms |
16324 KB |
Output is correct |
22 |
Correct |
180 ms |
16984 KB |
Output is correct |
23 |
Correct |
167 ms |
16964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Incorrect |
481 ms |
16960 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2648 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2660 KB |
Output is correct |
6 |
Correct |
3 ms |
2664 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
3 ms |
2772 KB |
Output is correct |
9 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2648 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2660 KB |
Output is correct |
6 |
Correct |
3 ms |
2664 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
3 ms |
2772 KB |
Output is correct |
9 |
Correct |
71 ms |
11628 KB |
Output is correct |
10 |
Correct |
108 ms |
13328 KB |
Output is correct |
11 |
Correct |
105 ms |
13204 KB |
Output is correct |
12 |
Correct |
126 ms |
13732 KB |
Output is correct |
13 |
Correct |
100 ms |
13828 KB |
Output is correct |
14 |
Correct |
88 ms |
11728 KB |
Output is correct |
15 |
Correct |
158 ms |
15320 KB |
Output is correct |
16 |
Correct |
171 ms |
15000 KB |
Output is correct |
17 |
Correct |
150 ms |
15624 KB |
Output is correct |
18 |
Correct |
176 ms |
15568 KB |
Output is correct |
19 |
Incorrect |
481 ms |
16960 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |