Submission #397820

# Submission time Handle Problem Language Result Execution time Memory
397820 2021-05-03T08:02:21 Z yuto1115 Swapping Cities (APIO20_swap) C++17
6 / 100
136 ms 16048 KB
#include "swap.h"
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, s, n) for(ll i = ll(s); i < ll(n); i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<P>;
using vvp = vector<vp>;
using vb = vector<bool>;
using vvb = vector<vb>;

template<class T>
bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const int inf = 1001001001;

namespace {
    int n;
    vvp G;
    vi deg;
    int mx;
    bool cycle;
}

void init(int _n, int m, vi u, vi v, vi w) {
    n = _n;
    G.resize(n);
    deg.resize(n);
    mx = 0;
    rep(i, m) {
        G[u[i]].eb(v[i], w[i]);
        G[v[i]].eb(u[i], w[i]);
        deg[u[i]]++;
        deg[v[i]]++;
        chmax(mx, w[i]);
    }
    cycle = true;
    rep(i, n) cycle &= deg[i] == 2;
}

int getMinimumFuelCapacity(int x, int y) {
    return (cycle ? mx : -1);
}
# 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 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 41 ms 6724 KB Output is correct
10 Correct 50 ms 8084 KB Output is correct
11 Correct 51 ms 8056 KB Output is correct
12 Correct 53 ms 8384 KB Output is correct
13 Correct 78 ms 8512 KB Output is correct
14 Correct 50 ms 6848 KB Output is correct
15 Correct 119 ms 10008 KB Output is correct
16 Correct 116 ms 9784 KB Output is correct
17 Correct 133 ms 10276 KB Output is correct
18 Correct 130 ms 10280 KB Output is correct
19 Correct 62 ms 5008 KB Output is correct
20 Correct 123 ms 15384 KB Output is correct
21 Correct 122 ms 15384 KB Output is correct
22 Correct 128 ms 16048 KB Output is correct
23 Correct 136 ms 16028 KB Output is 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 Incorrect 106 ms 10460 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 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 332 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 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 41 ms 6724 KB Output is correct
10 Correct 50 ms 8084 KB Output is correct
11 Correct 51 ms 8056 KB Output is correct
12 Correct 53 ms 8384 KB Output is correct
13 Correct 78 ms 8512 KB Output is correct
14 Correct 50 ms 6848 KB Output is correct
15 Correct 119 ms 10008 KB Output is correct
16 Correct 116 ms 9784 KB Output is correct
17 Correct 133 ms 10276 KB Output is correct
18 Correct 130 ms 10280 KB Output is correct
19 Incorrect 106 ms 10460 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