Submission #436481

# Submission time Handle Problem Language Result Execution time Memory
436481 2021-06-24T14:13:47 Z yuto1115 Stations (IOI20_stations) C++17
76 / 100
1317 ms 780 KB
#include "stations.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 rrep(i, n) for(ll i = ll(n)-1; i >= 0; i--)
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
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>;
using vs = vector<string>;

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;
}

vi label(int n, int k, vi u, vi v) {
    vvi G(n);
    rep(i, n - 1) {
        G[u[i]].pb(v[i]);
        G[v[i]].pb(u[i]);
    }
    int idx = 0;
    vi res(n);
    auto dfs = [&](auto &dfs, int now, int p, int d) -> void {
        if (d == 0) res[now] = idx;
        idx++;
        for (int nx : G[now]) {
            if (nx == p) continue;
            dfs(dfs, nx, now, d ^ 1);
        }
        if (d == 1) res[now] = idx;
        idx++;
    };
    dfs(dfs, 0, -1, 0);
    assert(idx == 2 * n);
    return res;
}

int find_next_station(int s, int t, vi c) {
    if (c[0] < s) {
        int pre = s;
        rrep(i, c.size()) {
            if (c[i] <= t and t < pre) return c[i];
            pre = c[i];
        }
        return pre;
    } else {
        int pre = s;
        rep(i, c.size()) {
            if (pre < t and t <= c[i]) return c[i];
            pre = c[i];
        }
        return pre;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 288 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1022
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 740 ms 488 KB Output is correct
2 Correct 629 ms 584 KB Output is correct
3 Correct 1130 ms 400 KB Output is correct
4 Correct 781 ms 400 KB Output is correct
5 Correct 997 ms 400 KB Output is correct
6 Correct 489 ms 712 KB Output is correct
7 Correct 710 ms 484 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 464 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 834 ms 480 KB Output is correct
12 Correct 465 ms 604 KB Output is correct
13 Correct 454 ms 592 KB Output is correct
14 Correct 596 ms 528 KB Output is correct
15 Correct 70 ms 412 KB Output is correct
16 Correct 72 ms 528 KB Output is correct
17 Correct 169 ms 528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1200 ms 400 KB Output is correct
2 Correct 735 ms 472 KB Output is correct
3 Correct 826 ms 400 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 644 ms 528 KB Output is correct
8 Correct 1004 ms 476 KB Output is correct
9 Correct 846 ms 400 KB Output is correct
10 Correct 864 ms 492 KB Output is correct
11 Correct 5 ms 476 KB Output is correct
12 Correct 8 ms 468 KB Output is correct
13 Correct 8 ms 468 KB Output is correct
14 Correct 3 ms 464 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 669 ms 428 KB Output is correct
17 Correct 752 ms 488 KB Output is correct
18 Correct 536 ms 484 KB Output is correct
19 Correct 745 ms 488 KB Output is correct
20 Correct 738 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 683 ms 580 KB Partially correct
2 Partially correct 533 ms 628 KB Partially correct
3 Correct 1317 ms 468 KB Output is correct
4 Correct 1039 ms 488 KB Output is correct
5 Correct 885 ms 400 KB Output is correct
6 Partially correct 640 ms 580 KB Partially correct
7 Partially correct 598 ms 480 KB Partially correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 4 ms 520 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Partially correct 514 ms 484 KB Partially correct
12 Partially correct 843 ms 492 KB Partially correct
13 Correct 1212 ms 484 KB Output is correct
14 Correct 937 ms 400 KB Output is correct
15 Correct 732 ms 488 KB Output is correct
16 Partially correct 647 ms 528 KB Partially correct
17 Correct 606 ms 400 KB Output is correct
18 Partially correct 583 ms 572 KB Partially correct
19 Partially correct 672 ms 656 KB Partially correct
20 Partially correct 427 ms 476 KB Partially correct
21 Correct 90 ms 420 KB Output is correct
22 Partially correct 106 ms 528 KB Partially correct
23 Partially correct 150 ms 528 KB Partially correct
24 Correct 5 ms 468 KB Output is correct
25 Correct 7 ms 420 KB Output is correct
26 Correct 5 ms 448 KB Output is correct
27 Correct 4 ms 476 KB Output is correct
28 Correct 2 ms 468 KB Output is correct
29 Correct 555 ms 492 KB Output is correct
30 Correct 732 ms 420 KB Output is correct
31 Correct 708 ms 488 KB Output is correct
32 Correct 671 ms 400 KB Output is correct
33 Correct 704 ms 488 KB Output is correct
34 Partially correct 373 ms 640 KB Partially correct
35 Partially correct 478 ms 724 KB Partially correct
36 Partially correct 546 ms 528 KB Partially correct
37 Partially correct 526 ms 740 KB Partially correct
38 Partially correct 435 ms 640 KB Partially correct
39 Partially correct 606 ms 780 KB Partially correct
40 Partially correct 547 ms 740 KB Partially correct
41 Partially correct 633 ms 588 KB Partially correct
42 Partially correct 97 ms 528 KB Partially correct
43 Partially correct 124 ms 576 KB Partially correct
44 Partially correct 164 ms 568 KB Partially correct
45 Partially correct 197 ms 528 KB Partially correct
46 Partially correct 323 ms 496 KB Partially correct
47 Partially correct 323 ms 488 KB Partially correct
48 Partially correct 62 ms 528 KB Partially correct
49 Partially correct 82 ms 672 KB Partially correct