답안 #361831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361831 2021-01-31T17:48:46 Z ryansee 기지국 (IOI20_stations) C++14
36.2303 / 100
1065 ms 1112 KB
#include "stations.h"

#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusive
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

long long LLINF = 1e18;
int INF = 1e9+1e6;
#define MAXN (200006)

vector<int> label(int n, int k, vector<int> U, vector<int> V) {
	vector<vector<int>> v(n, vector<int>());
	FOR(i,0,n-2) v[U[i]].eb(V[i]), v[V[i]].eb(U[i]);
	vector<int> st(n, 0), en(n, 0);
	int co = 0;
	function<void(int,int)>dfs=[&](int x,int p){
		st[x]=co++;
		for(auto i:v[x]) if(i^p) dfs(i, x);
		en[x]=co-1;
	};
	dfs(0, 0);
	vector<int> C(n);
	FOR(i,0,n-1) { //(pre, post)
		if(st[i] ^ en[i]) C[i] = st[i] + (en[i] << 10);
		else C[i] = st[i];
	}
	return C;
}
int pre(int x) {
	return x & ((1<<10) - 1);
}
int post(int x) {
	if((x >> 10) == 0) return pre(x);
	return (x >> 10);
}
int find_next_station(int S, int T, vector<int> c) {
	int s[2] = {pre(S), post(S)};
	int t[2] = {pre(T), post(T)};
	if(t[0] <= s[0] && t[1] >= s[1]) { // t is part of s
		for(auto i:c) if(pre(i) < s[0]) return i;
	} else if(s[0] <= t[0] && s[1] >= t[1]) {
		for(auto i:c) if(pre(i) <= t[0] && post(i) >= t[1] && pre(i) > s[0]) {
			return i;
		}
	} else {
		for(auto i:c) if(pre(i) < s[0]) return i;
	}
	assert(0);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 492 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=9216
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 364 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1018880
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 492 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=1019904
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1059 ms 756 KB Output is correct
2 Correct 712 ms 756 KB Output is correct
3 Correct 707 ms 872 KB Output is correct
4 Correct 3 ms 912 KB Output is correct
5 Correct 5 ms 776 KB Output is correct
6 Correct 2 ms 756 KB Output is correct
7 Correct 718 ms 864 KB Output is correct
8 Correct 1016 ms 768 KB Output is correct
9 Correct 698 ms 864 KB Output is correct
10 Correct 687 ms 1044 KB Output is correct
11 Correct 6 ms 736 KB Output is correct
12 Correct 7 ms 756 KB Output is correct
13 Correct 6 ms 864 KB Output is correct
14 Correct 5 ms 776 KB Output is correct
15 Correct 2 ms 864 KB Output is correct
16 Correct 600 ms 1012 KB Output is correct
17 Correct 641 ms 736 KB Output is correct
18 Correct 462 ms 736 KB Output is correct
19 Correct 628 ms 756 KB Output is correct
20 Correct 580 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 665 ms 884 KB Partially correct
2 Partially correct 546 ms 960 KB Partially correct
3 Partially correct 1065 ms 736 KB Partially correct
4 Partially correct 801 ms 736 KB Partially correct
5 Partially correct 723 ms 736 KB Partially correct
6 Partially correct 472 ms 864 KB Partially correct
7 Partially correct 540 ms 992 KB Partially correct
8 Partially correct 3 ms 756 KB Partially correct
9 Partially correct 4 ms 736 KB Partially correct
10 Partially correct 2 ms 736 KB Partially correct
11 Partially correct 506 ms 756 KB Partially correct
12 Partially correct 599 ms 772 KB Partially correct
13 Partially correct 1017 ms 756 KB Partially correct
14 Partially correct 737 ms 1000 KB Partially correct
15 Partially correct 662 ms 736 KB Partially correct
16 Partially correct 544 ms 784 KB Partially correct
17 Partially correct 642 ms 756 KB Partially correct
18 Partially correct 500 ms 976 KB Partially correct
19 Partially correct 497 ms 884 KB Partially correct
20 Partially correct 571 ms 784 KB Partially correct
21 Partially correct 58 ms 756 KB Partially correct
22 Partially correct 68 ms 736 KB Partially correct
23 Partially correct 130 ms 776 KB Partially correct
24 Partially correct 7 ms 872 KB Partially correct
25 Partially correct 7 ms 872 KB Partially correct
26 Partially correct 6 ms 872 KB Partially correct
27 Partially correct 4 ms 864 KB Partially correct
28 Partially correct 3 ms 884 KB Partially correct
29 Partially correct 602 ms 736 KB Partially correct
30 Partially correct 553 ms 736 KB Partially correct
31 Partially correct 579 ms 992 KB Partially correct
32 Partially correct 575 ms 992 KB Partially correct
33 Partially correct 542 ms 756 KB Partially correct
34 Partially correct 348 ms 1108 KB Partially correct
35 Partially correct 434 ms 864 KB Partially correct
36 Partially correct 490 ms 956 KB Partially correct
37 Partially correct 501 ms 1000 KB Partially correct
38 Partially correct 484 ms 988 KB Partially correct
39 Partially correct 589 ms 880 KB Partially correct
40 Partially correct 520 ms 992 KB Partially correct
41 Partially correct 566 ms 1044 KB Partially correct
42 Partially correct 77 ms 836 KB Partially correct
43 Partially correct 136 ms 756 KB Partially correct
44 Partially correct 147 ms 772 KB Partially correct
45 Partially correct 207 ms 868 KB Partially correct
46 Partially correct 363 ms 756 KB Partially correct
47 Partially correct 317 ms 884 KB Partially correct
48 Partially correct 71 ms 844 KB Partially correct
49 Partially correct 62 ms 864 KB Partially correct