Submission #1041727

#TimeUsernameProblemLanguageResultExecution timeMemory
1041727MuhammetSwapping Cities (APIO20_swap)C++17
0 / 100
2013 ms7084 KiB
#include <bits/stdc++.h> #include "swap.h" using namespace std; int n, m; vector <int> u, v, w; void init(int n1, int m1, vector<int> u1, vector<int> v1, vector<int> w1) { n = n1, m = m1, u = u1, v = v1, w = w1; } int getMinimumFuelCapacity(int x, int y) { if(m <= 2){ return -1; } if(x > y) swap(x,y); int ans = 0, mn = 1e9; for(int i = 0; i < m; i++){ if(max(u[i],v[i]) == x or max(u[i],v[i]) == y) ans += w[i]; else mn = min(mn,w[i]); } ans += 2*(mn); return ans; }
#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...