Submission #735432

#TimeUsernameProblemLanguageResultExecution timeMemory
735432keisuke6Swapping Cities (APIO20_swap)C++14
7 / 100
101 ms11132 KiB
#include "swap.h" #include <bits/stdc++.h> using namespace std; int N,M; vector<int> U,V,W,W_; void init(int NN, int MM, std::vector<int> UU, std::vector<int> VV, std::vector<int> WW) { N = NN; M = MM; U = UU; V = VV; W = WW; W_ = W; for(int i=0;i<M;i++){ W[V[i]-1] = W_[i]; } std::sort(W_.begin(),W_.end()); } int getMinimumFuelCapacity(int X, int Y) { if(N == 2 || N == 3) return -1; if(X == 0){ if(W_[1] >= W[Y-1]) return W_[2]; else return W[Y-1]; } else{ int a = W[X-1]; int b = W[Y-1]; if(a > b) swap(a,b); if(a == W_[0] && b == W_[1]) return W_[2]; else return b; } }
#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...