답안 #412975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412975 2021-05-27T21:43:48 Z SuhaibSawalha1 기지국 (IOI20_stations) C++17
5 / 100
1200 ms 632 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> adj;
vector<int> lab;
int cnt;

void dfs (int u, int p = -1) {
	for (int v : adj[u]) {
		if (v ^ p) {
			dfs(v, u);
		}
	}
	lab[u] = cnt++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	adj.assign(n, {});
	lab.resize(n);
	cnt = 0;
	for (int i = 0; i < n - 1; ++i) {
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	for (int i = 0; i < n; ++i) {
		if (adj[i].size() == 1) {
			dfs(i);
			break;
		}
	}
	return lab;
}
 
int find_next_station(int s, int t, vector<int> c) {
	return s - (t < s) + (t > s);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 661 ms 528 KB Output is correct
2 Correct 564 ms 532 KB Output is correct
3 Correct 994 ms 520 KB Output is correct
4 Correct 759 ms 488 KB Output is correct
5 Correct 718 ms 480 KB Output is correct
6 Correct 467 ms 520 KB Output is correct
7 Correct 596 ms 528 KB Output is correct
8 Correct 3 ms 480 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 620 ms 488 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 724 ms 632 KB Output is correct
2 Correct 648 ms 528 KB Output is correct
3 Correct 1200 ms 492 KB Output is correct
4 Correct 725 ms 404 KB Output is correct
5 Correct 646 ms 528 KB Output is correct
6 Correct 578 ms 528 KB Output is correct
7 Correct 545 ms 476 KB Output is correct
8 Correct 3 ms 464 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 2 ms 464 KB Output is correct
11 Incorrect 801 ms 484 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1103 ms 500 KB Output is correct
2 Correct 763 ms 400 KB Output is correct
3 Correct 785 ms 400 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Incorrect 694 ms 488 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 633 ms 612 KB Output is correct
2 Correct 598 ms 604 KB Output is correct
3 Correct 1055 ms 400 KB Output is correct
4 Correct 803 ms 400 KB Output is correct
5 Correct 598 ms 400 KB Output is correct
6 Correct 435 ms 616 KB Output is correct
7 Correct 603 ms 488 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 480 KB Output is correct
10 Correct 2 ms 472 KB Output is correct
11 Incorrect 537 ms 544 KB Wrong query response.
12 Halted 0 ms 0 KB -