답안 #308627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308627 2020-10-01T15:19:44 Z silverfish 기지국 (IOI20_stations) C++14
31.0422 / 100
1073 ms 1280 KB
#include <bits/stdc++.h>
#include "stations.h"
using namespace std;

/*<DEBUG>*/
#define tem template <typename 
#define can_shift(_X_, ...) enable_if_t<sizeof test<_X_>(0) __VA_ARGS__ 8, debug&> operator<<(T i)
#define _op debug& operator<<
tem C > auto test(C *x) -> decltype(cerr << *x, 0LL);
tem C > char test(...);
tem C > struct itr{C begin, end; };
tem C > itr<C> get_range(C b, C e) { return itr<C>{b, e}; };
struct debug{
#ifdef _LOCAL
	~debug(){ cerr << endl; }
	tem T > can_shift(T, ==){ cerr << boolalpha << i; return *this; }
	tem T> can_shift(T, !=){ return *this << get_range(begin(i), end(i)); }
	tem T, typename U > _op (pair<T, U> i){ 
		return *this << "< " << i.first << " , " << i.second << " >"; }
	tem T> _op (itr<T> i){
		*this <<  "{ ";
		for(auto it = i.begin; it != i.end; it++){
			*this << " , " + (it==i.begin?2:0) << *it;
		}
		return *this << " }";
	}
#else
tem T> _op (const T&) { return *this; }
#endif 
};

string _ARR_(int* arr, int sz){
	string ret = "{ " + to_string(arr[0]); 
	for(int i = 1; i < sz; i++) ret += " , " +  to_string(arr[i]);
	ret += " }"; return ret;
}

#define exp(...) " [ " << #__VA_ARGS__ << " : " << (__VA_ARGS__) << " ]"
/*</DEBUG>*/

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pii;

#define pb push_back
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define TC int __TC__; cin >> __TC__; while(__TC__--)

const int INF = 1e9 + 7;
const int MxN = 2000;

vector<int> adj[MxN];
int counter = 0;
vector<int> tin, tout;

void dfs(int v, int p){
	tin[v] = counter++;
	for(int u : adj[v]){
		if(u != p){
			dfs(u, v);
		}
	}
	tout[v] = counter++;
	return;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	counter = 0;
	for(int i= 0; i <= n; i++) adj[i].clear();
	tin.assign(n, -1);
	tout.assign(n, -1);

	for(int i = 0; i < n-1; i++){
		adj[u[i]].pb(v[i]);
		adj[v[i]].pb(u[i]);
	}

	dfs(0, 0);

	vector<int> labels(n);

	for(int i = 0; i < n; i++){
		labels[i] = 2000*tin[i] + tout[i];
	}

	return labels;
}

int in(int label) {
	return label / MxN;
}

int out(int label){
	return label % MxN;
}

bool inside(int a, int b){
	return in(a) <= in(b) && out(b) <= out(a);
}

int find_next_station(int s, int t, vector<int> c) {
	int p = -1;

	for(int cur : c){
		if(inside(cur, s)) p = cur;
	}

	for(int cur : c){
		if(inside(cur, t) && cur != p) return cur;
	}

	return p;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 512 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=14014
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 408 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=3, label=1157149
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1071 ms 1008 KB Output is correct
2 Correct 731 ms 768 KB Output is correct
3 Correct 609 ms 896 KB Output is correct
4 Correct 3 ms 896 KB Output is correct
5 Correct 4 ms 896 KB Output is correct
6 Correct 2 ms 896 KB Output is correct
7 Correct 761 ms 984 KB Output is correct
8 Correct 1073 ms 980 KB Output is correct
9 Correct 875 ms 896 KB Output is correct
10 Correct 686 ms 896 KB Output is correct
11 Correct 7 ms 984 KB Output is correct
12 Correct 7 ms 768 KB Output is correct
13 Correct 6 ms 768 KB Output is correct
14 Correct 5 ms 896 KB Output is correct
15 Correct 2 ms 768 KB Output is correct
16 Correct 651 ms 932 KB Output is correct
17 Correct 535 ms 896 KB Output is correct
18 Correct 521 ms 1052 KB Output is correct
19 Correct 732 ms 896 KB Output is correct
20 Correct 585 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 663 ms 1128 KB Partially correct
2 Partially correct 601 ms 1140 KB Partially correct
3 Partially correct 1010 ms 896 KB Partially correct
4 Partially correct 727 ms 896 KB Partially correct
5 Partially correct 720 ms 984 KB Partially correct
6 Partially correct 499 ms 1048 KB Partially correct
7 Partially correct 516 ms 896 KB Partially correct
8 Partially correct 3 ms 768 KB Partially correct
9 Partially correct 5 ms 880 KB Partially correct
10 Partially correct 2 ms 896 KB Partially correct
11 Partially correct 655 ms 928 KB Partially correct
12 Partially correct 562 ms 896 KB Partially correct
13 Partially correct 1037 ms 920 KB Partially correct
14 Partially correct 791 ms 988 KB Partially correct
15 Partially correct 735 ms 896 KB Partially correct
16 Partially correct 512 ms 1024 KB Partially correct
17 Partially correct 593 ms 896 KB Partially correct
18 Partially correct 546 ms 888 KB Partially correct
19 Partially correct 637 ms 1012 KB Partially correct
20 Partially correct 544 ms 896 KB Partially correct
21 Partially correct 62 ms 896 KB Partially correct
22 Partially correct 79 ms 896 KB Partially correct
23 Partially correct 108 ms 916 KB Partially correct
24 Partially correct 5 ms 988 KB Partially correct
25 Partially correct 6 ms 768 KB Partially correct
26 Partially correct 7 ms 896 KB Partially correct
27 Partially correct 5 ms 768 KB Partially correct
28 Partially correct 2 ms 896 KB Partially correct
29 Partially correct 681 ms 932 KB Partially correct
30 Partially correct 535 ms 980 KB Partially correct
31 Partially correct 572 ms 896 KB Partially correct
32 Partially correct 528 ms 984 KB Partially correct
33 Partially correct 590 ms 984 KB Partially correct
34 Partially correct 323 ms 1132 KB Partially correct
35 Partially correct 439 ms 1024 KB Partially correct
36 Partially correct 470 ms 1280 KB Partially correct
37 Partially correct 494 ms 1024 KB Partially correct
38 Partially correct 482 ms 1136 KB Partially correct
39 Partially correct 499 ms 1148 KB Partially correct
40 Partially correct 450 ms 1140 KB Partially correct
41 Partially correct 502 ms 1016 KB Partially correct
42 Partially correct 74 ms 932 KB Partially correct
43 Partially correct 120 ms 1040 KB Partially correct
44 Partially correct 139 ms 1024 KB Partially correct
45 Partially correct 169 ms 1024 KB Partially correct
46 Partially correct 313 ms 896 KB Partially correct
47 Partially correct 339 ms 904 KB Partially correct
48 Partially correct 74 ms 1132 KB Partially correct
49 Partially correct 70 ms 1112 KB Partially correct