Submission #373950

# Submission time Handle Problem Language Result Execution time Memory
373950 2021-03-06T09:25:25 Z Jarif_Rahman Stations (IOI20_stations) C++17
76 / 100
1091 ms 1272 KB
#include "stations.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
vector<vector<int>> v;
vector<int> lb, sz;
int in = 0;
void dfs(int nd, int ss, int d){
    if(d%2 == 0) lb[nd] = in;
    in++;
    for(int x: v[nd]) if(x != ss) dfs(x, nd, d+1);
    if(d%2 == 1) lb[nd] = in;
    in++;
}
vector<int> label(int n, int k, vector<int> aa, vector<int> bb){
    in = 0;
    v.assign(n, {});
    lb.assign(n, -1);
    for(int i = 0; i < n-1; i++){
        v[aa[i]].pb(bb[i]);
        v[bb[i]].pb(aa[i]);
    }
    dfs(0, -1, 0);
    return lb;
}
int find_next_station(int s, int t, vector<int> c){
    sort(c.begin(), c.end());
    if(s > c[0]){
        c.pb(s);
        for(int i = 1; i < (int)c.size() - 1; i++){
            if(t >= c[i] && t < c[i+1]) return c[i];
        }
        return c[0];
    }
    else{
        reverse(c.begin(), c.end());
        c.pb(s);
        for(int i = (s==0); i < (int)c.size()-1; i++){
            if(t <= c[i] && t > c[i+1]) return c[i];
        }
        return c[0];
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 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 4 ms 488 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 746 ms 912 KB Output is correct
2 Correct 576 ms 948 KB Output is correct
3 Correct 1071 ms 868 KB Output is correct
4 Correct 745 ms 660 KB Output is correct
5 Correct 616 ms 884 KB Output is correct
6 Correct 491 ms 968 KB Output is correct
7 Correct 477 ms 884 KB Output is correct
8 Correct 3 ms 756 KB Output is correct
9 Correct 4 ms 776 KB Output is correct
10 Correct 1 ms 736 KB Output is correct
11 Correct 561 ms 736 KB Output is correct
12 Correct 501 ms 864 KB Output is correct
13 Correct 449 ms 992 KB Output is correct
14 Correct 459 ms 788 KB Output is correct
15 Correct 58 ms 892 KB Output is correct
16 Correct 66 ms 940 KB Output is correct
17 Correct 111 ms 772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 896 ms 736 KB Output is correct
2 Correct 660 ms 736 KB Output is correct
3 Correct 636 ms 868 KB Output is correct
4 Correct 2 ms 756 KB Output is correct
5 Correct 5 ms 756 KB Output is correct
6 Correct 1 ms 736 KB Output is correct
7 Correct 685 ms 756 KB Output is correct
8 Correct 972 ms 884 KB Output is correct
9 Correct 768 ms 756 KB Output is correct
10 Correct 634 ms 868 KB Output is correct
11 Correct 7 ms 736 KB Output is correct
12 Correct 5 ms 756 KB Output is correct
13 Correct 6 ms 776 KB Output is correct
14 Correct 4 ms 756 KB Output is correct
15 Correct 2 ms 736 KB Output is correct
16 Correct 592 ms 1012 KB Output is correct
17 Correct 551 ms 868 KB Output is correct
18 Correct 567 ms 756 KB Output is correct
19 Correct 564 ms 756 KB Output is correct
20 Correct 533 ms 884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 616 ms 972 KB Partially correct
2 Partially correct 493 ms 864 KB Partially correct
3 Correct 887 ms 736 KB Output is correct
4 Correct 629 ms 868 KB Output is correct
5 Correct 630 ms 756 KB Output is correct
6 Partially correct 455 ms 956 KB Partially correct
7 Partially correct 552 ms 1004 KB Partially correct
8 Correct 3 ms 756 KB Output is correct
9 Correct 5 ms 756 KB Output is correct
10 Correct 2 ms 736 KB Output is correct
11 Partially correct 471 ms 1204 KB Partially correct
12 Partially correct 565 ms 736 KB Partially correct
13 Correct 1091 ms 756 KB Output is correct
14 Correct 784 ms 876 KB Output is correct
15 Correct 722 ms 736 KB Output is correct
16 Partially correct 471 ms 788 KB Partially correct
17 Correct 904 ms 756 KB Output is correct
18 Partially correct 431 ms 864 KB Partially correct
19 Partially correct 718 ms 1152 KB Partially correct
20 Partially correct 629 ms 792 KB Partially correct
21 Correct 71 ms 736 KB Output is correct
22 Partially correct 79 ms 1068 KB Partially correct
23 Partially correct 110 ms 736 KB Partially correct
24 Correct 7 ms 756 KB Output is correct
25 Correct 6 ms 868 KB Output is correct
26 Correct 5 ms 736 KB Output is correct
27 Correct 4 ms 756 KB Output is correct
28 Correct 2 ms 1000 KB Output is correct
29 Correct 612 ms 884 KB Output is correct
30 Correct 555 ms 756 KB Output is correct
31 Correct 576 ms 884 KB Output is correct
32 Correct 532 ms 916 KB Output is correct
33 Correct 638 ms 756 KB Output is correct
34 Partially correct 390 ms 1008 KB Partially correct
35 Partially correct 567 ms 1108 KB Partially correct
36 Partially correct 526 ms 992 KB Partially correct
37 Partially correct 514 ms 1144 KB Partially correct
38 Partially correct 558 ms 1044 KB Partially correct
39 Partially correct 462 ms 1112 KB Partially correct
40 Partially correct 514 ms 876 KB Partially correct
41 Partially correct 465 ms 1272 KB Partially correct
42 Partially correct 83 ms 796 KB Partially correct
43 Partially correct 147 ms 736 KB Partially correct
44 Partially correct 162 ms 756 KB Partially correct
45 Partially correct 193 ms 884 KB Partially correct
46 Partially correct 287 ms 952 KB Partially correct
47 Partially correct 308 ms 1000 KB Partially correct
48 Partially correct 70 ms 884 KB Partially correct
49 Partially correct 55 ms 992 KB Partially correct