답안 #430135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430135 2021-06-16T11:40:33 Z yanire 기지국 (IOI20_stations) C++17
0 / 100
1061 ms 584 KB
#include <bits/stdc++.h>
using namespace std;
#include "stations.h"
#define fin(i,s,n) for(auto i = s; i < n; ++i)
#define fine(i,s,n) for(auto i = s; i <= n; ++i)
#define x first
#define y second
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
template<class T> ostream& operator<<(ostream& os, vector<T> v) {
	if(v.empty()) return os << "[]";
	os << '[' << v[0];
	fin(i,1,int(v.size())) os << ',' << v[i];
	return os << ']';
}
const int maxn = 1005;
vi l;
int lid = 0;
vi g[maxn];
void dfs2(int u, int id) {
	if(l[u]!=-1) return;
	l[u] = id++;
	for(int v : g[u]) dfs2(v,id+1);
}
void dfs(int u) {
	if(l[u]!=-1) return;
	l[u] = lid++;
	for(int v : g[u]) dfs(v);
}
vi label(int n, int k, vi u, vi v) {
	l = vi(n,-1),lid = 0;
	fin(i,0,n) g[i].clear();
	fin(i,0,n-1) g[u[i]].pb(v[i]),g[v[i]].pb(u[i]);
	fin(i,0,n) if(g[i].size()>2) {
		l[i] = 0;
		int gid = 0;
		for(int v : g[i]) dfs2(v,1+(gid++*1000));
		return l;
	}
	fin(i,0,n) if(g[i].size()==1) { dfs2(i,0); break; }
	return l;
}
int dir(int a, int b){ 
	if(a==b) return 0;
	return b>a?1:-1;
}
bool anc(int u, int v) {
	while(v>=u) {
		if(u==v) return 1;
		v = (v-1)/2;
	}
	return 0;
}
int find_next_station(int s, int t, vi c) {
	if(s==0) {
		for(int v : c) if((v/1000)==(t/1000)) return v;
		return c[0];
	}
	if((s/1000)==(t/1000)) {
		for(int v : c) if(dir(s,v)==dir(s,t)) return v;
	} else return *min_element(all(c));
	return c[0];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 312 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=4, label=1016
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 296 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=3, label=1001
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 827 ms 584 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 895 ms 496 KB Output is correct
2 Correct 962 ms 528 KB Output is correct
3 Correct 811 ms 516 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 762 ms 512 KB Output is correct
8 Correct 1061 ms 400 KB Output is correct
9 Correct 801 ms 400 KB Output is correct
10 Correct 782 ms 512 KB Output is correct
11 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=5, label=3
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 660 ms 520 KB Wrong query response.
2 Halted 0 ms 0 KB -