Submission #404335

# Submission time Handle Problem Language Result Execution time Memory
404335 2021-05-14T08:23:00 Z AmineTrabelsi Stations (IOI20_stations) C++14
69.868 / 100
1079 ms 752 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int Mx = 1010;
int timer = 0;
void dfs(int node,int par,vector<int> &labels,vector<vector<int>> &tr,bool parity){
    if(!parity)labels[node] = timer++;
    for(auto i:tr[node]){
        if(i != par){
            dfs(i,node,labels,tr,!parity);
        }
    }
    if(parity)labels[node] = timer++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    vector<int> labels(n);
    vector<vector<int>> tr(n+1,vector<int>(0));
	for (int i = 0; i < n-1; i++) {
		tr[u[i]].push_back(v[i]);
        tr[v[i]].push_back(u[i]);
	}
    dfs(0,-1,labels,tr,0);
	return labels;
}
int find_next_station(int s, int t, vector<int> c) {
    if ((int)c.size() == 1) return c.back();
    if (c.front() > s){
        // s in tin
        int l = s, r = c[(int)c.size() - 2];
        if (l > t || r < t) return c.back();
        int pos = lower_bound(c.begin(), c.end(), t) - c.begin();
        return c[pos];
    }
    // s is tout
    int l = c[1], r = s;
    if (l > t || r < t) return c.front();
    int pos = upper_bound(c.begin(), c.end(), t) - c.begin() - 1;
    return c[pos];
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 416 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1008
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 276 KB Invalid labels (values out of range). scenario=1, k=1000, vertex=1, label=1507
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 579 ms 604 KB Output is correct
2 Correct 535 ms 592 KB Output is correct
3 Correct 877 ms 484 KB Output is correct
4 Correct 770 ms 400 KB Output is correct
5 Correct 696 ms 620 KB Output is correct
6 Correct 529 ms 656 KB Output is correct
7 Correct 585 ms 528 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 476 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 728 ms 496 KB Output is correct
12 Correct 540 ms 680 KB Output is correct
13 Correct 481 ms 604 KB Output is correct
14 Correct 426 ms 528 KB Output is correct
15 Correct 73 ms 432 KB Output is correct
16 Correct 86 ms 528 KB Output is correct
17 Correct 132 ms 528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 985 ms 400 KB Output is correct
2 Correct 871 ms 528 KB Output is correct
3 Correct 698 ms 484 KB Output is correct
4 Correct 3 ms 464 KB Output is correct
5 Correct 4 ms 464 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 748 ms 464 KB Output is correct
8 Correct 904 ms 400 KB Output is correct
9 Correct 720 ms 492 KB Output is correct
10 Correct 689 ms 528 KB Output is correct
11 Correct 7 ms 468 KB Output is correct
12 Correct 9 ms 468 KB Output is correct
13 Correct 6 ms 468 KB Output is correct
14 Correct 4 ms 496 KB Output is correct
15 Correct 2 ms 472 KB Output is correct
16 Correct 652 ms 484 KB Output is correct
17 Correct 548 ms 496 KB Output is correct
18 Correct 624 ms 528 KB Output is correct
19 Correct 657 ms 400 KB Output is correct
20 Correct 560 ms 656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 621 ms 708 KB Partially correct
2 Partially correct 565 ms 640 KB Partially correct
3 Correct 1051 ms 400 KB Output is correct
4 Correct 792 ms 484 KB Output is correct
5 Correct 767 ms 616 KB Output is correct
6 Partially correct 586 ms 612 KB Partially correct
7 Correct 532 ms 492 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 476 KB Output is correct
11 Partially correct 482 ms 596 KB Partially correct
12 Partially correct 570 ms 528 KB Partially correct
13 Correct 1079 ms 404 KB Output is correct
14 Correct 714 ms 400 KB Output is correct
15 Correct 705 ms 528 KB Output is correct
16 Correct 479 ms 520 KB Output is correct
17 Correct 799 ms 400 KB Output is correct
18 Partially correct 454 ms 752 KB Partially correct
19 Partially correct 581 ms 604 KB Partially correct
20 Correct 531 ms 528 KB Output is correct
21 Correct 68 ms 448 KB Output is correct
22 Partially correct 95 ms 528 KB Partially correct
23 Partially correct 118 ms 528 KB Partially correct
24 Correct 7 ms 468 KB Output is correct
25 Correct 7 ms 468 KB Output is correct
26 Correct 6 ms 476 KB Output is correct
27 Correct 5 ms 464 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 521 ms 484 KB Output is correct
30 Correct 601 ms 400 KB Output is correct
31 Correct 620 ms 400 KB Output is correct
32 Correct 610 ms 400 KB Output is correct
33 Correct 610 ms 488 KB Output is correct
34 Partially correct 326 ms 612 KB Partially correct
35 Partially correct 502 ms 612 KB Partially correct
36 Partially correct 503 ms 600 KB Partially correct
37 Partially correct 575 ms 488 KB Partially correct
38 Partially correct 480 ms 568 KB Partially correct
39 Partially correct 541 ms 652 KB Partially correct
40 Partially correct 501 ms 732 KB Partially correct
41 Partially correct 590 ms 576 KB Partially correct
42 Partially correct 57 ms 528 KB Partially correct
43 Partially correct 125 ms 488 KB Partially correct
44 Partially correct 150 ms 492 KB Partially correct
45 Partially correct 223 ms 528 KB Partially correct
46 Partially correct 407 ms 488 KB Partially correct
47 Partially correct 366 ms 528 KB Partially correct
48 Partially correct 76 ms 548 KB Partially correct
49 Partially correct 72 ms 656 KB Partially correct