답안 #430740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430740 2021-06-17T03:13:45 Z JUANDI321 기지국 (IOI20_stations) C++17
5 / 100
894 ms 592 KB
#include "stations.h"
#include <vector>
#include <iostream>
#include <cstring>
 
using namespace std;
vector<vector<int>> g(1000+10);
vector<int> l(1000 +10);
bool ch[1010];
 
void dfs(int node, int i)
{
	if(ch[node])return;
	ch[node]=true;
	l[i] = node;
	//cout<<node<<endl;
	for(int y : g[node])
	{
		if(!ch[y])
		{
			dfs(y, i+1);
		}
	}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) 
{
	vector<int> labels(n);
	for(int i = 0; i < n-1; i++)
	{
		g[u[i]].push_back(v[i]);
    	g[v[i]].push_back(u[i]);
	}
	int spn = 0;
	for(int i = 0; i < n; i++)
	{
		if(g[i].size() == 1)
		{
			spn = i;
			break;
		}
	}
	dfs(spn, 0);
	//cout<<"hola"<<endl;
	for (int i = 0; i < n; i++) 
	{
		labels[l[i]] = i;
		//cout<<"l[i] "<<l[i]<<" i "<<i<<endl;
	}
	memset(ch, false, sizeof(ch));
	for(int i=0; i<n; i++) g[i].clear(); 
	return labels;
}
 
int find_next_station(int s, int t, vector<int> c) 
{
	if(t>s)return s+1;
	return s-1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 510 ms 528 KB Output is correct
2 Correct 448 ms 524 KB Output is correct
3 Correct 894 ms 400 KB Output is correct
4 Correct 719 ms 520 KB Output is correct
5 Correct 574 ms 516 KB Output is correct
6 Correct 383 ms 508 KB Output is correct
7 Correct 380 ms 528 KB Output is correct
8 Correct 2 ms 420 KB Output is correct
9 Correct 5 ms 476 KB Output is correct
10 Correct 0 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 308 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 587 ms 532 KB Output is correct
2 Correct 486 ms 528 KB Output is correct
3 Correct 810 ms 400 KB Output is correct
4 Correct 709 ms 400 KB Output is correct
5 Correct 628 ms 520 KB Output is correct
6 Correct 452 ms 492 KB Output is correct
7 Correct 421 ms 504 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 2 ms 428 KB Output is correct
11 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=1, label=0
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 886 ms 400 KB Output is correct
2 Correct 729 ms 400 KB Output is correct
3 Correct 545 ms 400 KB Output is correct
4 Correct 1 ms 472 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 1 ms 480 KB Output is correct
7 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=3, label=0
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 493 ms 544 KB Output is correct
2 Correct 472 ms 592 KB Output is correct
3 Correct 845 ms 400 KB Output is correct
4 Correct 660 ms 400 KB Output is correct
5 Correct 552 ms 400 KB Output is correct
6 Correct 431 ms 528 KB Output is correct
7 Correct 441 ms 528 KB Output is correct
8 Correct 2 ms 472 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Incorrect 6 ms 312 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -