제출 #743478

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7434782023-05-17 12:13:59MauveSwapping Cities (APIO20_swap)C++14
13 / 100
451 ms20372 KiB
#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(n<=3) return -1;
if(X==0 || Y==0){
if(Y==0) swap(X,Y);
st.erase({v[Y][0].ss,Y});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...