#include <bits/stdc++.h>
using namespace std;
map<int,set<int>> adj;
multiset<int> ms;
map<pair<int,int>,int> edwt;
int SUBTASK1=0;
bool isCyc=0;
bool isSubtask1=true;
bool isCycle(){
for(auto x:adj){
if(x.second.size()<=1)return false;
if(x.second.size()>2)isSubtask1=false;
}
return true;
}
void init(int N, int M,std::vector<int> U, std::vector<int> V, std::vector<int> W) {
for(int i=0;i<M;i++){
int x=U[i];
int y=V[i];
int z=W[i];
ms.insert(z);
edwt[{min(x,y),max(x,y)}]=z;
SUBTASK1=max(SUBTASK1,(W[i]));
adj[x].insert(y);
adj[y].insert(x);
}
isCyc=isCycle();
}
int getMinimumFuelCapacity(int X, int Y) {
return -1;
// if(isSubtask1){
// if(isCyc){
// return SUBTASK1;
// }else
// return -1;
// }else{
// if(1 or min(X,Y)==0){
// return -1;
// }
// int one = edwt[{0,X}];
// int two = edwt[{0,Y}];
// int res=one+two;
// ms.erase(ms.find(one));
// ms.erase(ms.find(two));
// if(ms.size()>0)
// res+=(*ms.begin());
// ms.insert(one);
// ms.insert(two);
// return res;
// }
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
620 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
2 ms |
640 KB |
Output is correct |
8 |
Correct |
2 ms |
620 KB |
Output is correct |
9 |
Correct |
328 ms |
25452 KB |
Output is correct |
10 |
Correct |
390 ms |
31212 KB |
Output is correct |
11 |
Correct |
411 ms |
30700 KB |
Output is correct |
12 |
Correct |
422 ms |
32492 KB |
Output is correct |
13 |
Correct |
443 ms |
32492 KB |
Output is correct |
14 |
Correct |
305 ms |
25708 KB |
Output is correct |
15 |
Correct |
478 ms |
33144 KB |
Output is correct |
16 |
Correct |
476 ms |
32540 KB |
Output is correct |
17 |
Correct |
500 ms |
34384 KB |
Output is correct |
18 |
Correct |
515 ms |
34260 KB |
Output is correct |
19 |
Incorrect |
92 ms |
7788 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Incorrect |
389 ms |
36716 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
620 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
2 ms |
640 KB |
Output is correct |
8 |
Correct |
2 ms |
620 KB |
Output is correct |
9 |
Correct |
328 ms |
25452 KB |
Output is correct |
10 |
Correct |
390 ms |
31212 KB |
Output is correct |
11 |
Correct |
411 ms |
30700 KB |
Output is correct |
12 |
Correct |
422 ms |
32492 KB |
Output is correct |
13 |
Correct |
443 ms |
32492 KB |
Output is correct |
14 |
Correct |
305 ms |
25708 KB |
Output is correct |
15 |
Correct |
478 ms |
33144 KB |
Output is correct |
16 |
Correct |
476 ms |
32540 KB |
Output is correct |
17 |
Correct |
500 ms |
34384 KB |
Output is correct |
18 |
Correct |
515 ms |
34260 KB |
Output is correct |
19 |
Incorrect |
389 ms |
36716 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |