답안 #308150

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308150 2020-09-30T06:33:28 Z jwvg0425 기지국 (IOI20_stations) C++17
0 / 100
3 ms 888 KB
#include "stations.h"
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second

using namespace std;

template<typename T, typename Pr = less<T>>
using pq = priority_queue<T, vector<T>, Pr>;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

vector<int> edge[1005];
int in[1005], out[1005];
int t = 0;

void dfs(int root)
{
	in[root] = t;
	t++;

	for (auto& e : edge[root])
	{
		edge[e].erase(find(all(edge[e]), root));
		dfs(e);
	}

	out[root] = t;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	for (int i = 0; i < n - 1; i++)
	{
		edge[u[i]].push_back(v[i]);
		edge[v[i]].push_back(u[i]);
	}

	dfs(1);

	vector<int> res(n);
	for (int i = 0; i < n; i++)
		res[i] = in[i] * 1000 + out[i];

	return res;
}

int find_next_station(int s, int t, vector<int> c) {
	int ti = t / 1000;
	int to = t % 1000;
	int si = s / 1000;
	int so = s % 1000;
	int p = -1;

	for (auto& e : c)
	{
		int ei = e / 1000;
		int eo = e % 1000;

		if (ei <= ti && eo >= to)
			return e;

		if (ei <= si && eo >= so)
			p = e;
	}

	return p;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -