답안 #429314

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
429314 2021-06-15T20:30:55 Z abdzag 기지국 (IOI20_stations) C++17
5 / 100
1273 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;
	queue<ll> q;
	rep(i, 0, g.size()) {
		if (g[i].size() == 1)q.push(i);
	}
	vector<int> ans(n);
	vector<bool> visited(n);
	ll counter2 = 0;
	while (!q.empty()) {
		cur = q.front();
		q.pop();
		while (counter < n) {
			visited[cur] = 1;
			ans[cur] = counter2++;
			counter++;
			trav(a, g[cur])if (!visited[a])cur = a;
			if (g[cur].size() > 2) {
				counter2 = ((counter2 / 3000) + 1) * 3000;
				ans[cur] = 1e5;
				break;
			}

		}
	}
	
	return ans;
}

int find_next_station(int s, int t, vector<int> c) {
	int ans;
	if (abs(s - t) > 1000) {
		ans = -1;
		trav(a, c)ans = max(a, ans);
	}
	else 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 725 ms 568 KB Output is correct
2 Correct 592 ms 532 KB Output is correct
3 Correct 970 ms 400 KB Output is correct
4 Correct 692 ms 400 KB Output is correct
5 Correct 630 ms 400 KB Output is correct
6 Correct 531 ms 488 KB Output is correct
7 Correct 504 ms 528 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 320 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 625 ms 528 KB Output is correct
2 Correct 536 ms 484 KB Output is correct
3 Correct 998 ms 528 KB Output is correct
4 Correct 722 ms 484 KB Output is correct
5 Correct 654 ms 400 KB Output is correct
6 Correct 554 ms 616 KB Output is correct
7 Correct 576 ms 480 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 2 ms 476 KB Output is correct
11 Incorrect 680 ms 492 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1109 ms 400 KB Output is correct
2 Correct 851 ms 488 KB Output is correct
3 Correct 729 ms 400 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Incorrect 818 ms 400 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 613 ms 488 KB Output is correct
2 Correct 493 ms 500 KB Output is correct
3 Correct 1273 ms 472 KB Output is correct
4 Correct 711 ms 588 KB Output is correct
5 Correct 701 ms 400 KB Output is correct
6 Correct 573 ms 488 KB Output is correct
7 Correct 486 ms 544 KB Output is correct
8 Correct 4 ms 468 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 2 ms 480 KB Output is correct
11 Incorrect 5 ms 284 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -