Submission #395299

# Submission time Handle Problem Language Result Execution time Memory
395299 2021-04-28T06:13:15 Z abc864197532 Swapping Cities (APIO20_swap) C++17
0 / 100
122 ms 7444 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) {
    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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 35 ms 2112 KB Output is correct
10 Correct 54 ms 2444 KB Output is correct
11 Correct 33 ms 2500 KB Output is correct
12 Correct 53 ms 2628 KB Output is correct
13 Correct 35 ms 2624 KB Output is correct
14 Correct 35 ms 2252 KB Output is correct
15 Correct 120 ms 6732 KB Output is correct
16 Correct 122 ms 7288 KB Output is correct
17 Correct 115 ms 7336 KB Output is correct
18 Correct 111 ms 7444 KB Output is correct
19 Incorrect 62 ms 4592 KB Output isn't correct
20 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 Incorrect 92 ms 4200 KB Output isn't correct
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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# 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 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 35 ms 2112 KB Output is correct
10 Correct 54 ms 2444 KB Output is correct
11 Correct 33 ms 2500 KB Output is correct
12 Correct 53 ms 2628 KB Output is correct
13 Correct 35 ms 2624 KB Output is correct
14 Correct 35 ms 2252 KB Output is correct
15 Correct 120 ms 6732 KB Output is correct
16 Correct 122 ms 7288 KB Output is correct
17 Correct 115 ms 7336 KB Output is correct
18 Correct 111 ms 7444 KB Output is correct
19 Incorrect 92 ms 4200 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct