답안 #361833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361833 2021-01-31T17:54:15 Z ryansee 기지국 (IOI20_stations) C++14
36.2303 / 100
1085 ms 1240 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 = 1;
	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) { //(post, pre)
		if(st[i] ^ en[i]) C[i] = en[i] + (st[i] << 10);
		else C[i] = en[i];
	}
	return C;
}
int post(int x) {
	return x & ((1<<10) - 1);
}
int pre(int x) {
	if((x >> 10) == 0) return post(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=1034
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=2020
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=67, label=1008613
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 949 ms 1000 KB Output is correct
2 Correct 738 ms 884 KB Output is correct
3 Correct 670 ms 884 KB Output is correct
4 Correct 3 ms 864 KB Output is correct
5 Correct 5 ms 756 KB Output is correct
6 Correct 2 ms 736 KB Output is correct
7 Correct 746 ms 872 KB Output is correct
8 Correct 1085 ms 864 KB Output is correct
9 Correct 677 ms 756 KB Output is correct
10 Correct 672 ms 864 KB Output is correct
11 Correct 6 ms 864 KB Output is correct
12 Correct 6 ms 904 KB Output is correct
13 Correct 6 ms 736 KB Output is correct
14 Correct 5 ms 756 KB Output is correct
15 Correct 2 ms 864 KB Output is correct
16 Correct 568 ms 768 KB Output is correct
17 Correct 579 ms 872 KB Output is correct
18 Correct 633 ms 756 KB Output is correct
19 Correct 517 ms 756 KB Output is correct
20 Correct 602 ms 756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 583 ms 884 KB Partially correct
2 Partially correct 452 ms 864 KB Partially correct
3 Partially correct 916 ms 756 KB Partially correct
4 Partially correct 745 ms 864 KB Partially correct
5 Partially correct 612 ms 864 KB Partially correct
6 Partially correct 486 ms 884 KB Partially correct
7 Partially correct 469 ms 884 KB Partially correct
8 Partially correct 3 ms 864 KB Partially correct
9 Partially correct 5 ms 736 KB Partially correct
10 Partially correct 1 ms 736 KB Partially correct
11 Partially correct 572 ms 756 KB Partially correct
12 Partially correct 633 ms 736 KB Partially correct
13 Partially correct 973 ms 884 KB Partially correct
14 Partially correct 762 ms 864 KB Partially correct
15 Partially correct 600 ms 992 KB Partially correct
16 Partially correct 586 ms 756 KB Partially correct
17 Partially correct 602 ms 864 KB Partially correct
18 Partially correct 534 ms 1084 KB Partially correct
19 Partially correct 514 ms 992 KB Partially correct
20 Partially correct 553 ms 924 KB Partially correct
21 Partially correct 62 ms 864 KB Partially correct
22 Partially correct 75 ms 736 KB Partially correct
23 Partially correct 122 ms 756 KB Partially correct
24 Partially correct 7 ms 756 KB Partially correct
25 Partially correct 6 ms 912 KB Partially correct
26 Partially correct 5 ms 736 KB Partially correct
27 Partially correct 4 ms 864 KB Partially correct
28 Partially correct 2 ms 1012 KB Partially correct
29 Partially correct 529 ms 736 KB Partially correct
30 Partially correct 565 ms 756 KB Partially correct
31 Partially correct 558 ms 660 KB Partially correct
32 Partially correct 718 ms 864 KB Partially correct
33 Partially correct 525 ms 864 KB Partially correct
34 Partially correct 403 ms 884 KB Partially correct
35 Partially correct 532 ms 948 KB Partially correct
36 Partially correct 541 ms 884 KB Partially correct
37 Partially correct 539 ms 984 KB Partially correct
38 Partially correct 602 ms 984 KB Partially correct
39 Partially correct 563 ms 1236 KB Partially correct
40 Partially correct 530 ms 884 KB Partially correct
41 Partially correct 555 ms 1240 KB Partially correct
42 Partially correct 82 ms 1012 KB Partially correct
43 Partially correct 108 ms 756 KB Partially correct
44 Partially correct 146 ms 772 KB Partially correct
45 Partially correct 173 ms 992 KB Partially correct
46 Partially correct 401 ms 736 KB Partially correct
47 Partially correct 362 ms 884 KB Partially correct
48 Partially correct 65 ms 864 KB Partially correct
49 Partially correct 56 ms 736 KB Partially correct