Submission #395301

# Submission time Handle Problem Language Result Execution time Memory
395301 2021-04-28T06:16:21 Z abc864197532 Swapping Cities (APIO20_swap) C++17
0 / 100
2000 ms 4360 KB
#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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Execution timed out 2079 ms 204 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Execution timed out 2079 ms 4360 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Execution timed out 2079 ms 204 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Execution timed out 2079 ms 204 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Execution timed out 2079 ms 204 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Execution timed out 2079 ms 204 KB Time limit exceeded
5 Halted 0 ms 0 KB -