Submission #395301

#TimeUsernameProblemLanguageResultExecution timeMemory
395301abc864197532Swapping Cities (APIO20_swap)C++17
0 / 100
2079 ms4360 KiB
#include <bits/stdc++.h> // #include "grader_swap.cpp" using namespace std; #define lli long long int #define mp make_pair #define pb push_back #define eb emplace_back #define test(x) cout << "Line(" << __LINE__ << ") " #x << ' ' << x << endl #define printv(x) {\ for (auto i : x) cout << i << ' ';\ cout << endl;\ } #define pii pair <int, int> #define pll pair <lli, lli> #define X first #define Y second #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() template<typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a){ return o << a.X << ' ' << a.Y; } template<typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a){ return o >> a.X >> a.Y; } const int mod = 1e9 + 7, abc = 864197532, Doludu = 123, N = 100001, logN = 18, K = 40; int n, m; vector <int> w; multiset <int> m1; void init(int _n, int _m, vector <int> _u, vector <int> _v, vector <int> _w) { n = _n; w.resize(n); for (int i = 0; i < m; ++i) w[_v[i]] = _w[i], m1.insert(_w[i]); } int getMinimumFuelCapacity(int u, int v) { if (n <= 3) return -1; if (u == 0) { m1.erase(m1.lower_bound(w[v])); int k = *m1.begin(); m1.erase(m1.begin()); int res = max({w[v], k, *m1.begin()}); m1.insert(k); m1.insert(w[v]); return res; } else { m1.erase(m1.lower_bound(w[u])); m1.erase(m1.lower_bound(w[v])); int res = max({w[u], w[v], *m1.begin()}); m1.insert(w[u]); m1.insert(w[v]); return res; } }
#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...