답안 #395302

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
395302 2021-04-28T06:18:37 Z abc864197532 자매 도시 (APIO20_swap) C++17
0 / 100
104 ms 6000 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;
int a1 = 1 << 30, a2 = 1 << 30, a3 = 1 << 30;

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];
        if (a1 >= _w[i]) a3 = a2, a2 = a1, a1 = w[i];
        else if (a2 >= _w[i]) a3 = a2, a2 = _w[i];
        else if (a3 >= _w[i]) a3 = _w[i];
    }
}

int getMinimumFuelCapacity(int u, int v) {
    if (n <= 3) return -1;
    if (u == 0) {
        if (a1 == w[v]) return a2;
        return a1;
    } else {
        if (a1 == w[v] && a2 == w[u]) return a3;
        if (a1 == w[u] && a2 == w[v]) return a3;
        if (a1 == w[v] || a1 == w[u]) return a2;
        return a1;
    }
}
# 결과 실행 시간 메모리 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 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 104 ms 6000 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -