답안 #510376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
510376 2022-01-15T00:51:13 Z jamezzz 기지국 (IOI20_stations) C++17
52.3205 / 100
1466 ms 796 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

int pre[1005],pst[1005],cnt;
vector<int> AL[1005];

void dfs(int u){
	pre[u]=cnt++;
	for(int v:AL[u]){
		if(pre[v]==-1)dfs(v);
	}
	pst[u]=cnt-1;
}

vector<int> label(int n,int k,vector<int> u,vector<int> v){
	vector<int> l(n);
	for(int i=0;i<n;++i)AL[i].clear();
	memset(pre,-1,sizeof pre);
	memset(pst,-1,sizeof pst);
	cnt=0;
	for(int i=0;i<n-1;++i){
		AL[u[i]].push_back(v[i]);
		AL[v[i]].push_back(u[i]);
	}
	dfs(0);
	for(int i=0;i<n;++i)l[i]=pre[i]*1000+pst[i];
	return l;
}

int find_next_station(int s,int t,vector<int> c){
	int pres=s/1000,psts=s%1000;
	int pret=t/1000,pstt=t%1000;
	for(int i=1;i<c.size();++i){
		int u=c[i];
		int preu=u/1000,pstu=u%1000;
		if(preu<=pret&&pstt<=pstu)return u;
	}
	return c[0];
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:34:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for(int i=1;i<c.size();++i){
      |              ~^~~~~~~~~
stations.cpp:32:6: warning: unused variable 'pres' [-Wunused-variable]
   32 |  int pres=s/1000,psts=s%1000;
      |      ^~~~
stations.cpp:32:18: warning: unused variable 'psts' [-Wunused-variable]
   32 |  int pres=s/1000,psts=s%1000;
      |                  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 292 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 372 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 870 ms 604 KB Output is correct
2 Correct 578 ms 512 KB Output is correct
3 Correct 1172 ms 404 KB Output is correct
4 Correct 1039 ms 500 KB Output is correct
5 Correct 936 ms 504 KB Output is correct
6 Correct 771 ms 584 KB Output is correct
7 Correct 680 ms 508 KB Output is correct
8 Correct 2 ms 476 KB Output is correct
9 Correct 5 ms 452 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 926 ms 508 KB Output is correct
12 Correct 540 ms 724 KB Output is correct
13 Correct 617 ms 712 KB Output is correct
14 Correct 604 ms 500 KB Output is correct
15 Correct 73 ms 532 KB Output is correct
16 Correct 107 ms 528 KB Output is correct
17 Correct 87 ms 728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 935 ms 504 KB Output is correct
2 Correct 890 ms 500 KB Output is correct
3 Correct 836 ms 400 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 536 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 634 ms 488 KB Output is correct
8 Correct 1128 ms 500 KB Output is correct
9 Correct 823 ms 636 KB Output is correct
10 Correct 838 ms 400 KB Output is correct
11 Correct 4 ms 468 KB Output is correct
12 Correct 9 ms 540 KB Output is correct
13 Correct 7 ms 476 KB Output is correct
14 Correct 4 ms 596 KB Output is correct
15 Correct 2 ms 500 KB Output is correct
16 Correct 747 ms 512 KB Output is correct
17 Correct 628 ms 492 KB Output is correct
18 Correct 730 ms 508 KB Output is correct
19 Correct 886 ms 624 KB Output is correct
20 Correct 865 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 944 ms 492 KB Partially correct
2 Partially correct 726 ms 624 KB Partially correct
3 Partially correct 1416 ms 504 KB Partially correct
4 Partially correct 642 ms 632 KB Partially correct
5 Partially correct 826 ms 508 KB Partially correct
6 Partially correct 581 ms 704 KB Partially correct
7 Partially correct 680 ms 508 KB Partially correct
8 Partially correct 2 ms 480 KB Partially correct
9 Partially correct 5 ms 468 KB Partially correct
10 Partially correct 1 ms 468 KB Partially correct
11 Partially correct 705 ms 504 KB Partially correct
12 Partially correct 938 ms 504 KB Partially correct
13 Partially correct 1466 ms 504 KB Partially correct
14 Partially correct 873 ms 504 KB Partially correct
15 Partially correct 577 ms 512 KB Partially correct
16 Partially correct 439 ms 500 KB Partially correct
17 Partially correct 869 ms 504 KB Partially correct
18 Partially correct 473 ms 712 KB Partially correct
19 Partially correct 489 ms 688 KB Partially correct
20 Partially correct 505 ms 528 KB Partially correct
21 Partially correct 54 ms 488 KB Partially correct
22 Partially correct 115 ms 692 KB Partially correct
23 Partially correct 213 ms 780 KB Partially correct
24 Partially correct 8 ms 492 KB Partially correct
25 Partially correct 8 ms 596 KB Partially correct
26 Partially correct 11 ms 420 KB Partially correct
27 Partially correct 9 ms 576 KB Partially correct
28 Partially correct 1 ms 468 KB Partially correct
29 Partially correct 537 ms 600 KB Partially correct
30 Partially correct 635 ms 548 KB Partially correct
31 Partially correct 613 ms 504 KB Partially correct
32 Partially correct 713 ms 504 KB Partially correct
33 Partially correct 519 ms 492 KB Partially correct
34 Partially correct 448 ms 572 KB Partially correct
35 Partially correct 517 ms 728 KB Partially correct
36 Partially correct 654 ms 592 KB Partially correct
37 Partially correct 707 ms 620 KB Partially correct
38 Partially correct 688 ms 608 KB Partially correct
39 Partially correct 511 ms 720 KB Partially correct
40 Partially correct 697 ms 796 KB Partially correct
41 Partially correct 525 ms 628 KB Partially correct
42 Partially correct 82 ms 528 KB Partially correct
43 Partially correct 126 ms 640 KB Partially correct
44 Partially correct 157 ms 608 KB Partially correct
45 Partially correct 172 ms 632 KB Partially correct
46 Partially correct 401 ms 580 KB Partially correct
47 Partially correct 405 ms 504 KB Partially correct
48 Partially correct 69 ms 648 KB Partially correct
49 Partially correct 56 ms 744 KB Partially correct