답안 #1080015

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080015 2024-08-29T06:11:08 Z Faisal_Saqib 기지국 (IOI20_stations) C++17
5 / 100
611 ms 936 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+100;
vector<int> ma[N];
vector<int> labels;
void dfs(int x,int v,int p)
{
	labels[x]=v;
	for(auto y:ma[x])
	{
		if(y==p)continue;
		dfs(y,v+1,x);
	}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	labels.resize(n,0);
	for(int i=0;i<(n);i++)ma[i].clear();
	for(int i=0;i<(n-1);i++)
	{
		ma[u[i]].push_back(v[i]);
		ma[v[i]].push_back(u[i]);
	}
	for(int i=0;i<n;i++)
	{
		if(ma[i].size()==1)
		{
			dfs(i,0,-1);
		}
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(t>s)
		return *max_element(begin(c),end(c));
	return *min_element(begin(c),end(c));
}
# 결과 실행 시간 메모리 Grader output
1 Correct 355 ms 936 KB Output is correct
2 Correct 307 ms 684 KB Output is correct
3 Correct 603 ms 700 KB Output is correct
4 Correct 461 ms 684 KB Output is correct
5 Correct 395 ms 684 KB Output is correct
6 Correct 290 ms 936 KB Output is correct
7 Correct 297 ms 684 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 1 ms 776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 344 KB Invalid labels (duplicates values). scenario=0, label=11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 374 ms 684 KB Output is correct
2 Correct 300 ms 688 KB Output is correct
3 Correct 551 ms 804 KB Output is correct
4 Correct 447 ms 684 KB Output is correct
5 Correct 397 ms 684 KB Output is correct
6 Correct 289 ms 684 KB Output is correct
7 Correct 307 ms 684 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 0 ms 760 KB Output is correct
11 Incorrect 0 ms 344 KB Invalid labels (duplicates values). scenario=1, label=2
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 608 ms 684 KB Output is correct
2 Correct 439 ms 684 KB Output is correct
3 Correct 374 ms 684 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 0 ms 776 KB Output is correct
7 Incorrect 1 ms 344 KB Invalid labels (duplicates values). scenario=0, label=2
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 328 ms 684 KB Output is correct
2 Correct 359 ms 684 KB Output is correct
3 Correct 611 ms 684 KB Output is correct
4 Correct 461 ms 684 KB Output is correct
5 Correct 450 ms 684 KB Output is correct
6 Correct 278 ms 684 KB Output is correct
7 Correct 319 ms 684 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 3 ms 764 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Incorrect 25 ms 344 KB Invalid labels (duplicates values). scenario=0, label=11
12 Halted 0 ms 0 KB -