답안 #429249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
429249 2021-06-15T19:31:06 Z abdzag 기지국 (IOI20_stations) C++17
5 / 100
1251 ms 616 KB
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#include "stations.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b);i--)
#define trav(a,v) for(auto& a: v)
#define sz(v) v.size()
#define all(v) v.begin(),v.end()
#define vi vector<int>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const long long inf = 2e9;

using namespace std;

vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	ll counter = 0;
	vector<vector<ll>> g(n);
	rep(i, 0, n - 1) {
		g[u[i]].push_back(v[i]);
		g[v[i]].push_back(u[i]);
	}
	ll cur = 0;
	rep(i, 0, g.size()) {
		if (g[i].size() == 1)cur = i;
	}
	vector<int> ans(n);
	vector<bool> visited(n);
	while (counter < n) {
		visited[cur] = 1;
		ans[cur] = counter++;
		trav(a, g[cur])if (!visited[a])cur = a;
	}
	return ans;
}

int find_next_station(int s, int t, vector<int> c) {
	int ans;
	if (s < t) {
		ans = -1;
		trav(a, c)ans = max(a, ans);
	}
	else {
		ans = 1e7;
		trav(a, c)ans = min(a, ans);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 562 ms 492 KB Output is correct
2 Correct 604 ms 528 KB Output is correct
3 Correct 1101 ms 404 KB Output is correct
4 Correct 982 ms 400 KB Output is correct
5 Correct 711 ms 400 KB Output is correct
6 Correct 564 ms 520 KB Output is correct
7 Correct 503 ms 476 KB Output is correct
8 Correct 3 ms 476 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 6 ms 284 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 555 ms 528 KB Output is correct
2 Correct 500 ms 528 KB Output is correct
3 Correct 1077 ms 472 KB Output is correct
4 Correct 817 ms 400 KB Output is correct
5 Correct 901 ms 420 KB Output is correct
6 Correct 679 ms 484 KB Output is correct
7 Correct 564 ms 536 KB Output is correct
8 Correct 3 ms 584 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Incorrect 1 ms 292 KB Invalid labels (duplicates values). scenario=1, label=0
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 921 ms 476 KB Output is correct
2 Correct 920 ms 484 KB Output is correct
3 Correct 752 ms 400 KB Output is correct
4 Correct 3 ms 448 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 464 KB Output is correct
7 Incorrect 1 ms 268 KB Invalid labels (duplicates values). scenario=0, label=0
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 562 ms 616 KB Output is correct
2 Correct 627 ms 572 KB Output is correct
3 Correct 1251 ms 468 KB Output is correct
4 Correct 1148 ms 488 KB Output is correct
5 Correct 756 ms 400 KB Output is correct
6 Correct 483 ms 472 KB Output is correct
7 Correct 555 ms 492 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Incorrect 5 ms 276 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -