답안 #322078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
322078 2020-11-14T02:43:30 Z gurkot 기지국 (IOI20_stations) C++14
100 / 100
1261 ms 1372 KB
#include "stations.h"
#include <vector>
#include <iostream> 
using namespace std; 
int fix[1000],lab[1000],timer,lev;
vector <int> gr[1000];
 
void dfs(int u){  
 fix[u]=1; lev++;
 if((lev&1)==0) lab[u]=timer++;     
    
 for(int i=0;i<(int)gr[u].size();i++)
  if(fix[gr[u][i]]==0) dfs(gr[u][i]);		
	
 if((lev&1)==1) lab[u]=timer++;
 lev--;	
}
 
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
 vector <int> labels; labels.resize(n); 
 for(int i=0;i<n;i++) {
  gr[i].clear();  lab[i]=fix[i]=0;
 }
	
 for (int i=0; i<(int)u.size(); i++) {
  gr[u[i]].push_back(v[i]);
  gr[v[i]].push_back(u[i]);
 }  

 timer=0; lev=-1;
 dfs(0);
 for(int i=0;i<n;i++)   labels[i]=lab[i];  
 return labels;
} 
int find_next_station(int s, int t, vector<int> c) {
 if(s<c[0]){
  c.insert(c.begin(),s);
  for(int i=1; i<(int)c.size()-1; i++)
	if(t<=c[i] && t>c[i-1]) return c[i];			
  return c[c.size()-1];
 } else {
  c.push_back(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];
 }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 572 ms 1104 KB Output is correct
2 Correct 468 ms 992 KB Output is correct
3 Correct 1037 ms 944 KB Output is correct
4 Correct 957 ms 864 KB Output is correct
5 Correct 853 ms 992 KB Output is correct
6 Correct 484 ms 1108 KB Output is correct
7 Correct 501 ms 864 KB Output is correct
8 Correct 3 ms 864 KB Output is correct
9 Correct 5 ms 984 KB Output is correct
10 Correct 2 ms 864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 629 ms 864 KB Output is correct
2 Correct 442 ms 892 KB Output is correct
3 Correct 982 ms 992 KB Output is correct
4 Correct 902 ms 736 KB Output is correct
5 Correct 652 ms 864 KB Output is correct
6 Correct 434 ms 864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 671 ms 1004 KB Output is correct
2 Correct 459 ms 1108 KB Output is correct
3 Correct 929 ms 768 KB Output is correct
4 Correct 789 ms 864 KB Output is correct
5 Correct 630 ms 992 KB Output is correct
6 Correct 599 ms 992 KB Output is correct
7 Correct 582 ms 864 KB Output is correct
8 Correct 3 ms 944 KB Output is correct
9 Correct 5 ms 864 KB Output is correct
10 Correct 2 ms 864 KB Output is correct
11 Correct 732 ms 944 KB Output is correct
12 Correct 462 ms 1248 KB Output is correct
13 Correct 512 ms 1120 KB Output is correct
14 Correct 435 ms 1024 KB Output is correct
15 Correct 65 ms 736 KB Output is correct
16 Correct 67 ms 736 KB Output is correct
17 Correct 118 ms 964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1261 ms 864 KB Output is correct
2 Correct 941 ms 836 KB Output is correct
3 Correct 686 ms 1108 KB Output is correct
4 Correct 4 ms 884 KB Output is correct
5 Correct 4 ms 864 KB Output is correct
6 Correct 1 ms 944 KB Output is correct
7 Correct 641 ms 884 KB Output is correct
8 Correct 801 ms 944 KB Output is correct
9 Correct 739 ms 748 KB Output is correct
10 Correct 610 ms 896 KB Output is correct
11 Correct 6 ms 952 KB Output is correct
12 Correct 8 ms 736 KB Output is correct
13 Correct 4 ms 736 KB Output is correct
14 Correct 4 ms 992 KB Output is correct
15 Correct 2 ms 864 KB Output is correct
16 Correct 508 ms 864 KB Output is correct
17 Correct 530 ms 864 KB Output is correct
18 Correct 519 ms 944 KB Output is correct
19 Correct 473 ms 1136 KB Output is correct
20 Correct 633 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 545 ms 992 KB Output is correct
2 Correct 448 ms 1104 KB Output is correct
3 Correct 982 ms 944 KB Output is correct
4 Correct 700 ms 1236 KB Output is correct
5 Correct 768 ms 944 KB Output is correct
6 Correct 566 ms 1104 KB Output is correct
7 Correct 554 ms 864 KB Output is correct
8 Correct 3 ms 836 KB Output is correct
9 Correct 5 ms 992 KB Output is correct
10 Correct 1 ms 736 KB Output is correct
11 Correct 537 ms 864 KB Output is correct
12 Correct 662 ms 864 KB Output is correct
13 Correct 974 ms 736 KB Output is correct
14 Correct 731 ms 944 KB Output is correct
15 Correct 642 ms 992 KB Output is correct
16 Correct 513 ms 896 KB Output is correct
17 Correct 689 ms 1012 KB Output is correct
18 Correct 435 ms 1120 KB Output is correct
19 Correct 486 ms 864 KB Output is correct
20 Correct 488 ms 896 KB Output is correct
21 Correct 71 ms 944 KB Output is correct
22 Correct 72 ms 864 KB Output is correct
23 Correct 103 ms 736 KB Output is correct
24 Correct 7 ms 736 KB Output is correct
25 Correct 6 ms 864 KB Output is correct
26 Correct 5 ms 736 KB Output is correct
27 Correct 4 ms 736 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 493 ms 736 KB Output is correct
30 Correct 515 ms 944 KB Output is correct
31 Correct 547 ms 944 KB Output is correct
32 Correct 661 ms 864 KB Output is correct
33 Correct 621 ms 992 KB Output is correct
34 Correct 357 ms 992 KB Output is correct
35 Correct 477 ms 1092 KB Output is correct
36 Correct 613 ms 1104 KB Output is correct
37 Correct 667 ms 1108 KB Output is correct
38 Correct 521 ms 1372 KB Output is correct
39 Correct 474 ms 1120 KB Output is correct
40 Correct 565 ms 1108 KB Output is correct
41 Correct 540 ms 1244 KB Output is correct
42 Correct 77 ms 736 KB Output is correct
43 Correct 110 ms 736 KB Output is correct
44 Correct 169 ms 864 KB Output is correct
45 Correct 179 ms 1124 KB Output is correct
46 Correct 344 ms 1132 KB Output is correct
47 Correct 323 ms 864 KB Output is correct
48 Correct 62 ms 992 KB Output is correct
49 Correct 65 ms 1092 KB Output is correct