답안 #314127

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
314127 2020-10-18T15:46:09 Z Jasiekstrz 기지국 (IOI20_stations) C++17
100 / 100
1184 ms 1280 KB
#include<bits/stdc++.h>
#include "stations.h"
#define fi first
#define se second
using namespace std;
vector<int> e[1010];
vector<int> ans;
int dfs(int x,int p,int id,bool t)
{
	if(!t)
		ans[x]=id++;
	for(auto v:e[x])
	{
		if(v!=p)
			id=dfs(v,x,id,!t);
	}
	if(t)
		ans[x]=id++;
	return id;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v)
{
	ans=vector<int>(n);
	for(int i=0;i<n;i++)
		e[i].clear();
	for(int i=0;i<n-1;i++)
	{
		e[u[i]].push_back(v[i]);
		e[v[i]].push_back(u[i]);
	}
	dfs(0,0,0,0);
	return ans;
}
int find_next_station(int s,int t,vector<int> c)
{
	if(c[0]>s)
	{
		if(t<s)
			return c.back();
		for(size_t i=0;i<c.size()-1;i++)
		{
			if(t<=c[i])
				return c[i];
		}
		return c.back();
	}
	else
	{
		if(t>s)
			return c[0];
		for(size_t i=c.size()-1;i>0;i--)
		{
			if(t>=c[i])
				return c[i];
		}
		return c[0];
	}
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 519 ms 1024 KB Output is correct
2 Correct 452 ms 1024 KB Output is correct
3 Correct 846 ms 780 KB Output is correct
4 Correct 658 ms 768 KB Output is correct
5 Correct 596 ms 876 KB Output is correct
6 Correct 456 ms 1280 KB Output is correct
7 Correct 600 ms 776 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 4 ms 1012 KB Output is correct
10 Correct 1 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 553 ms 768 KB Output is correct
2 Correct 525 ms 1056 KB Output is correct
3 Correct 895 ms 768 KB Output is correct
4 Correct 873 ms 768 KB Output is correct
5 Correct 577 ms 876 KB Output is correct
6 Correct 439 ms 832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 554 ms 1024 KB Output is correct
2 Correct 433 ms 1024 KB Output is correct
3 Correct 921 ms 896 KB Output is correct
4 Correct 644 ms 896 KB Output is correct
5 Correct 569 ms 880 KB Output is correct
6 Correct 456 ms 1024 KB Output is correct
7 Correct 463 ms 768 KB Output is correct
8 Correct 3 ms 876 KB Output is correct
9 Correct 5 ms 872 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
11 Correct 593 ms 768 KB Output is correct
12 Correct 485 ms 928 KB Output is correct
13 Correct 483 ms 1008 KB Output is correct
14 Correct 478 ms 768 KB Output is correct
15 Correct 48 ms 872 KB Output is correct
16 Correct 66 ms 768 KB Output is correct
17 Correct 105 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 916 ms 880 KB Output is correct
2 Correct 934 ms 768 KB Output is correct
3 Correct 660 ms 768 KB Output is correct
4 Correct 2 ms 876 KB Output is correct
5 Correct 5 ms 888 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 838 ms 900 KB Output is correct
8 Correct 1184 ms 768 KB Output is correct
9 Correct 680 ms 876 KB Output is correct
10 Correct 789 ms 768 KB Output is correct
11 Correct 6 ms 768 KB Output is correct
12 Correct 6 ms 1024 KB Output is correct
13 Correct 4 ms 872 KB Output is correct
14 Correct 3 ms 880 KB Output is correct
15 Correct 2 ms 768 KB Output is correct
16 Correct 564 ms 768 KB Output is correct
17 Correct 556 ms 1036 KB Output is correct
18 Correct 483 ms 876 KB Output is correct
19 Correct 516 ms 768 KB Output is correct
20 Correct 481 ms 1044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 637 ms 1024 KB Output is correct
2 Correct 431 ms 1024 KB Output is correct
3 Correct 894 ms 892 KB Output is correct
4 Correct 768 ms 1048 KB Output is correct
5 Correct 680 ms 880 KB Output is correct
6 Correct 573 ms 1024 KB Output is correct
7 Correct 439 ms 788 KB Output is correct
8 Correct 3 ms 884 KB Output is correct
9 Correct 4 ms 780 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
11 Correct 469 ms 812 KB Output is correct
12 Correct 541 ms 768 KB Output is correct
13 Correct 926 ms 876 KB Output is correct
14 Correct 668 ms 876 KB Output is correct
15 Correct 569 ms 872 KB Output is correct
16 Correct 458 ms 820 KB Output is correct
17 Correct 611 ms 768 KB Output is correct
18 Correct 467 ms 768 KB Output is correct
19 Correct 470 ms 1128 KB Output is correct
20 Correct 437 ms 1048 KB Output is correct
21 Correct 56 ms 768 KB Output is correct
22 Correct 72 ms 768 KB Output is correct
23 Correct 110 ms 812 KB Output is correct
24 Correct 7 ms 768 KB Output is correct
25 Correct 6 ms 768 KB Output is correct
26 Correct 4 ms 768 KB Output is correct
27 Correct 3 ms 888 KB Output is correct
28 Correct 2 ms 768 KB Output is correct
29 Correct 532 ms 776 KB Output is correct
30 Correct 488 ms 876 KB Output is correct
31 Correct 509 ms 880 KB Output is correct
32 Correct 583 ms 768 KB Output is correct
33 Correct 530 ms 876 KB Output is correct
34 Correct 338 ms 1024 KB Output is correct
35 Correct 543 ms 1024 KB Output is correct
36 Correct 532 ms 1024 KB Output is correct
37 Correct 459 ms 776 KB Output is correct
38 Correct 474 ms 768 KB Output is correct
39 Correct 557 ms 768 KB Output is correct
40 Correct 531 ms 768 KB Output is correct
41 Correct 506 ms 784 KB Output is correct
42 Correct 72 ms 828 KB Output is correct
43 Correct 105 ms 820 KB Output is correct
44 Correct 121 ms 768 KB Output is correct
45 Correct 171 ms 768 KB Output is correct
46 Correct 377 ms 816 KB Output is correct
47 Correct 383 ms 788 KB Output is correct
48 Correct 66 ms 1024 KB Output is correct
49 Correct 61 ms 1024 KB Output is correct