#include "swap.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#define ll int
#define pl pair<ll, ll>
#define llv vector<ll>
#define pb push_back
#define ppb(x, y) push_back({x, y})
#define pv vector<pl>
#define sz size()
#define ss second
#define ff first
using namespace std;
const int N = 2 * 1e5 + 3;
bool f = 0, f1 = 1;
pv v;
llv w[N];
int a[N], b, k = 0, q = 0, p = 0;
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W)
{
for (int i=0; i<M; i++)
{
w[V[i]].pb(U[i]);
w[U[i]].pb(V[i]);
}
for (int i=0; i<N; i++)
{
if (w[i].sz == 2) q++;
if (w[i].sz == 1) p++;
}
if (p == 2 && q + p == N) f = 1;
for (int i=0; i<M; i++) v.ppb(W[i], V[i]);
sort(v.begin(), v.end());
b = v[2].ff;
for (int i=0; i<M; i++) a[V[i]] = W[i];
for (int i=0; i<M; i++)
k = max(k, W[i]);
f1 = (N == M);
return ;
}
int getMinimumFuelCapacity(int X, int Y)
{
if (f) return -1;
if (f1) return k;
return max({b, a[X], a[Y]});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
5 ms |
4940 KB |
Output is correct |
3 |
Correct |
4 ms |
4940 KB |
Output is correct |
4 |
Correct |
4 ms |
4940 KB |
Output is correct |
5 |
Correct |
4 ms |
4940 KB |
Output is correct |
6 |
Correct |
4 ms |
5044 KB |
Output is correct |
7 |
Correct |
4 ms |
5068 KB |
Output is correct |
8 |
Correct |
5 ms |
5068 KB |
Output is correct |
9 |
Correct |
58 ms |
10392 KB |
Output is correct |
10 |
Correct |
66 ms |
11456 KB |
Output is correct |
11 |
Correct |
69 ms |
11304 KB |
Output is correct |
12 |
Correct |
73 ms |
11772 KB |
Output is correct |
13 |
Correct |
70 ms |
11696 KB |
Output is correct |
14 |
Correct |
60 ms |
10564 KB |
Output is correct |
15 |
Correct |
132 ms |
13324 KB |
Output is correct |
16 |
Correct |
127 ms |
13168 KB |
Output is correct |
17 |
Correct |
140 ms |
13460 KB |
Output is correct |
18 |
Correct |
138 ms |
13444 KB |
Output is correct |
19 |
Correct |
66 ms |
9540 KB |
Output is correct |
20 |
Correct |
134 ms |
14444 KB |
Output is correct |
21 |
Correct |
137 ms |
14488 KB |
Output is correct |
22 |
Correct |
137 ms |
14972 KB |
Output is correct |
23 |
Correct |
139 ms |
14872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
5 ms |
4940 KB |
Output is correct |
3 |
Correct |
123 ms |
14708 KB |
Output is correct |
4 |
Correct |
131 ms |
14976 KB |
Output is correct |
5 |
Correct |
126 ms |
15120 KB |
Output is correct |
6 |
Correct |
120 ms |
14848 KB |
Output is correct |
7 |
Correct |
138 ms |
15088 KB |
Output is correct |
8 |
Correct |
125 ms |
14784 KB |
Output is correct |
9 |
Correct |
128 ms |
14976 KB |
Output is correct |
10 |
Correct |
123 ms |
14704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
5 ms |
4940 KB |
Output is correct |
3 |
Correct |
4 ms |
4940 KB |
Output is correct |
4 |
Correct |
4 ms |
4940 KB |
Output is correct |
5 |
Correct |
4 ms |
4940 KB |
Output is correct |
6 |
Correct |
4 ms |
5044 KB |
Output is correct |
7 |
Correct |
4 ms |
5068 KB |
Output is correct |
8 |
Correct |
5 ms |
5068 KB |
Output is correct |
9 |
Incorrect |
3 ms |
4940 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4940 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
4940 KB |
Output is correct |
2 |
Correct |
5 ms |
4940 KB |
Output is correct |
3 |
Correct |
4 ms |
4940 KB |
Output is correct |
4 |
Correct |
4 ms |
4940 KB |
Output is correct |
5 |
Correct |
4 ms |
4940 KB |
Output is correct |
6 |
Correct |
4 ms |
5044 KB |
Output is correct |
7 |
Correct |
4 ms |
5068 KB |
Output is correct |
8 |
Correct |
5 ms |
5068 KB |
Output is correct |
9 |
Correct |
58 ms |
10392 KB |
Output is correct |
10 |
Correct |
66 ms |
11456 KB |
Output is correct |
11 |
Correct |
69 ms |
11304 KB |
Output is correct |
12 |
Correct |
73 ms |
11772 KB |
Output is correct |
13 |
Correct |
70 ms |
11696 KB |
Output is correct |
14 |
Correct |
60 ms |
10564 KB |
Output is correct |
15 |
Correct |
132 ms |
13324 KB |
Output is correct |
16 |
Correct |
127 ms |
13168 KB |
Output is correct |
17 |
Correct |
140 ms |
13460 KB |
Output is correct |
18 |
Correct |
138 ms |
13444 KB |
Output is correct |
19 |
Correct |
123 ms |
14708 KB |
Output is correct |
20 |
Correct |
131 ms |
14976 KB |
Output is correct |
21 |
Correct |
126 ms |
15120 KB |
Output is correct |
22 |
Correct |
120 ms |
14848 KB |
Output is correct |
23 |
Correct |
138 ms |
15088 KB |
Output is correct |
24 |
Correct |
125 ms |
14784 KB |
Output is correct |
25 |
Correct |
128 ms |
14976 KB |
Output is correct |
26 |
Correct |
123 ms |
14704 KB |
Output is correct |
27 |
Incorrect |
4 ms |
5044 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4940 KB |
Output isn't correct |