답안 #951515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951515 2024-03-22T04:39:40 Z Nhoksocqt1 자매 도시 (APIO20_swap) C++17
0 / 100
86 ms 15148 KB
#include<bits/stdc++.h>
using namespace std;

#define inf 0x3f3f3f3f
#define sz(x) int((x).size())
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;

template<class X, class Y>
	inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
	inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

const int MAXN = 100005;

struct Edge {
    int u, v, w;
} edge[2 * MAXN];

vector<ii> adj[MAXN];
int deg[MAXN], maxw, numNode, numEdge;
bool check_sub1, check_sub2;

void init(int _N, int _M, vector<int> _U, vector<int> _V, vector<int> _W) {
    numNode = _N, numEdge = _M;

    check_sub2 = 1;
    for (int i = 0; i < numEdge; ++i) {
        edge[i] = {_U[i], _V[i], _W[i]};
        adj[edge[i].u].push_back(ii(edge[i].v, edge[i].w));
        check_sub2 &= (edge[i].u == 0);
        maxw = max(maxw, edge[i].w);
    }

    for (int i = 0; i < numNode; ++i)
        check_sub1 &= (sz(adj[i]) <= 2);

    sort(edge, edge + numEdge, [](const Edge &a, const Edge &b) {
        return (a.w < b.w);
    });
}

int getMinimumFuelCapacity(int x, int y) {
    if(check_sub1)
        return maxw;

    return -1;
}

#ifdef Nhoksocqt1

int main(void) {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    #define TASK "swap"
    if(fopen(TASK".inp", "r")) {
        freopen(TASK".inp", "r", stdin);
        freopen(TASK".out", "w", stdout);
    }

    vector<int> _U, _V, _W;
    int _N, _M, _Q;
    cin >> _N >> _M >> _Q;

    _U.resize(_M), _V.resize(_M), _W.resize(_M);
    for (int i = 0; i < _M; ++i) {
        cin >> _U[i] >> _V[i] >> _W[i];
    }

    init(_N, _M, _U, _V, _W);
    for (int t = 0; t < _Q; ++t) {
        int _X, _Y;
        cin >> _X >> _Y;
        cout << "MINIMUM FUEL CAPACITY " << _X << ' ' << " TO " << _Y << ": " << getMinimumFuelCapacity(_X, _Y) << '\n';
    }

    return 0;
}

#endif // Nhoksocqt1
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 2 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 2 ms 4836 KB Output is correct
6 Correct 2 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 2 ms 4444 KB Output is correct
9 Correct 30 ms 9656 KB Output is correct
10 Correct 35 ms 10584 KB Output is correct
11 Correct 39 ms 10576 KB Output is correct
12 Correct 35 ms 11220 KB Output is correct
13 Correct 43 ms 11088 KB Output is correct
14 Correct 33 ms 9820 KB Output is correct
15 Correct 78 ms 14896 KB Output is correct
16 Correct 80 ms 14780 KB Output is correct
17 Correct 79 ms 14924 KB Output is correct
18 Correct 86 ms 15148 KB Output is correct
19 Incorrect 42 ms 9624 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 2 ms 4440 KB Output is correct
3 Incorrect 80 ms 13012 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 2 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 2 ms 4836 KB Output is correct
6 Correct 2 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 2 ms 4444 KB Output is correct
9 Incorrect 1 ms 4440 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 2 ms 4440 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 2 ms 4836 KB Output is correct
6 Correct 2 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 2 ms 4444 KB Output is correct
9 Correct 30 ms 9656 KB Output is correct
10 Correct 35 ms 10584 KB Output is correct
11 Correct 39 ms 10576 KB Output is correct
12 Correct 35 ms 11220 KB Output is correct
13 Correct 43 ms 11088 KB Output is correct
14 Correct 33 ms 9820 KB Output is correct
15 Correct 78 ms 14896 KB Output is correct
16 Correct 80 ms 14780 KB Output is correct
17 Correct 79 ms 14924 KB Output is correct
18 Correct 86 ms 15148 KB Output is correct
19 Incorrect 80 ms 13012 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -