답안 #305445

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
305445 2020-09-23T07:17:23 Z lohacho 기지국 (IOI20_stations) C++14
100 / 100
1178 ms 1280 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

using LL = long long;
const int INF = (int)1e9 + 7;
const int NS = (int)1e3 + 4;

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n);
	int label_num = 0, chk[NS];
	memset(chk, 0, sizeof(chk));
	vector < int > way[NS];
	for(int i = 0; i < n - 1; ++i){
        way[u[i]].push_back(v[i]);
        way[v[i]].push_back(u[i]);
	}
	function < void(int, int) > dfs = [&](int x, int dep){
        chk[x] = 1;
        if(dep % 2) labels[x] = label_num++;
        for(auto&nxt:way[x]){
            if(chk[nxt]) continue;
            dfs(nxt, dep + 1);
        }
        if(dep % 2 == 0) labels[x] = label_num++;
	};
	dfs(0, 1);
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if((int)c.size() == 1) return c[0];
    if(s < c[0]){
        if(t < s || t > c[(int)c.size() - 2]) return c.back();
        for(auto&i:c){
            if(t <= i) return i;
        }
    }
    else{
        if(t < c[1] || t > s) return c.front();
        for(int i = (int)c.size() - 1; ; --i){
            if(t >= c[i]) return c[i];
        }
    }
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 739 ms 1024 KB Output is correct
2 Correct 448 ms 1024 KB Output is correct
3 Correct 1178 ms 884 KB Output is correct
4 Correct 876 ms 880 KB Output is correct
5 Correct 593 ms 888 KB Output is correct
6 Correct 497 ms 1024 KB Output is correct
7 Correct 449 ms 904 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 5 ms 768 KB Output is correct
10 Correct 2 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 440 ms 824 KB Output is correct
2 Correct 542 ms 824 KB Output is correct
3 Correct 891 ms 864 KB Output is correct
4 Correct 666 ms 768 KB Output is correct
5 Correct 575 ms 880 KB Output is correct
6 Correct 441 ms 828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 523 ms 1024 KB Output is correct
2 Correct 440 ms 1024 KB Output is correct
3 Correct 861 ms 876 KB Output is correct
4 Correct 642 ms 876 KB Output is correct
5 Correct 603 ms 884 KB Output is correct
6 Correct 468 ms 1024 KB Output is correct
7 Correct 454 ms 768 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 4 ms 888 KB Output is correct
10 Correct 2 ms 888 KB Output is correct
11 Correct 559 ms 740 KB Output is correct
12 Correct 454 ms 1128 KB Output is correct
13 Correct 450 ms 1024 KB Output is correct
14 Correct 468 ms 824 KB Output is correct
15 Correct 72 ms 768 KB Output is correct
16 Correct 87 ms 768 KB Output is correct
17 Correct 132 ms 832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1009 ms 768 KB Output is correct
2 Correct 791 ms 876 KB Output is correct
3 Correct 624 ms 768 KB Output is correct
4 Correct 3 ms 768 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 2 ms 768 KB Output is correct
7 Correct 690 ms 896 KB Output is correct
8 Correct 974 ms 880 KB Output is correct
9 Correct 711 ms 876 KB Output is correct
10 Correct 655 ms 768 KB Output is correct
11 Correct 6 ms 876 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
13 Correct 5 ms 876 KB Output is correct
14 Correct 4 ms 768 KB Output is correct
15 Correct 2 ms 872 KB Output is correct
16 Correct 653 ms 768 KB Output is correct
17 Correct 641 ms 1004 KB Output is correct
18 Correct 688 ms 876 KB Output is correct
19 Correct 588 ms 768 KB Output is correct
20 Correct 558 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 582 ms 1064 KB Output is correct
2 Correct 532 ms 1280 KB Output is correct
3 Correct 1126 ms 760 KB Output is correct
4 Correct 653 ms 872 KB Output is correct
5 Correct 715 ms 776 KB Output is correct
6 Correct 446 ms 1024 KB Output is correct
7 Correct 466 ms 768 KB Output is correct
8 Correct 3 ms 880 KB Output is correct
9 Correct 5 ms 1016 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
11 Correct 435 ms 896 KB Output is correct
12 Correct 612 ms 828 KB Output is correct
13 Correct 1033 ms 768 KB Output is correct
14 Correct 811 ms 768 KB Output is correct
15 Correct 721 ms 744 KB Output is correct
16 Correct 537 ms 832 KB Output is correct
17 Correct 584 ms 884 KB Output is correct
18 Correct 457 ms 788 KB Output is correct
19 Correct 464 ms 1124 KB Output is correct
20 Correct 431 ms 792 KB Output is correct
21 Correct 60 ms 876 KB Output is correct
22 Correct 72 ms 848 KB Output is correct
23 Correct 117 ms 952 KB Output is correct
24 Correct 6 ms 880 KB Output is correct
25 Correct 5 ms 888 KB Output is correct
26 Correct 5 ms 888 KB Output is correct
27 Correct 5 ms 876 KB Output is correct
28 Correct 2 ms 768 KB Output is correct
29 Correct 500 ms 776 KB Output is correct
30 Correct 515 ms 880 KB Output is correct
31 Correct 518 ms 876 KB Output is correct
32 Correct 491 ms 824 KB Output is correct
33 Correct 486 ms 760 KB Output is correct
34 Correct 314 ms 1024 KB Output is correct
35 Correct 434 ms 1024 KB Output is correct
36 Correct 464 ms 1024 KB Output is correct
37 Correct 532 ms 1008 KB Output is correct
38 Correct 565 ms 920 KB Output is correct
39 Correct 560 ms 912 KB Output is correct
40 Correct 554 ms 800 KB Output is correct
41 Correct 543 ms 800 KB Output is correct
42 Correct 79 ms 836 KB Output is correct
43 Correct 114 ms 768 KB Output is correct
44 Correct 145 ms 820 KB Output is correct
45 Correct 175 ms 812 KB Output is correct
46 Correct 345 ms 768 KB Output is correct
47 Correct 389 ms 852 KB Output is correct
48 Correct 67 ms 828 KB Output is correct
49 Correct 62 ms 768 KB Output is correct