Submission #1225968

#TimeUsernameProblemLanguageResultExecution timeMemory
1225968SpyrosAlivSwapping Cities (APIO20_swap)C++20
0 / 100
0 ms324 KiB
#include "swap.h" #include <bits/stdc++.h> using namespace std; const int MN = 2e5+5; const int INF = 1e9+10; const int LOG = 22; int n, m; vector<int> w, weights; void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) { n = N; m = M; w.assign(n, 0); for (int i = 0; i < n-1; i ++) { w[V[i]] = W[i]; weights.push_back(W[i]); } sort(weights.begin(), weights.end()); } int getMinimumFuelCapacity(int X, int Y) { int a = X; int b = Y; if (a > b) swap(a, b); if (n == 2) return -1; int ans = max(w[a], w[b]); if (a == 0) { if (w[b] == weights[0]) ans = max(ans, weights[1]); } else { if (min(w[a], w[b]) == weights[0]) { if (max(w[a], w[b]) == weights[1]) { ans = max(ans, weights[2]); } else ans = max(ans, weights[1]); } } 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...