Submission #313914

# Submission time Handle Problem Language Result Execution time Memory
313914 2020-10-17T09:44:46 Z srvlt Stations (IOI20_stations) C++14
0 / 100
970 ms 1024 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define SZ(x) (int)(x).size()
#define all(x) begin(x), end(x)

const int n0 = 1003;
int T, d[n0];
vector <int> g[n0], ind;
void dfs(int v, int p) {
	if (!d[v]) ind[v] = T++;
	for (int to : g[v]) {
		if (to == p) continue;
		d[to] = d[v] ^ 1;
		dfs(to, v);
	}
	if (d[v]) ind[v] = T++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	T = 0, memset(& d, 0, sizeof(d));
	ind = vector <int>(n);
	for (int i = 0; i < n; i++) g[i].clear();
	for (int i = 0; i < SZ(u); i++)
		g[u[i]].pb(v[i]), g[v[i]].pb(u[i]);
	dfs(0, 0);
	return ind;
}

int find_next_station(int s, int t, vector<int> c) {
	for (int i = 0; i < SZ(c) - 1; i++)
		if (t >= min(s, c[i]) && t <= max(s, c[i]))
			return c[i];
	return c.back();
}
# Verdict Execution time Memory Grader output
1 Incorrect 545 ms 1024 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 455 ms 768 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 632 ms 780 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 970 ms 768 KB Output is correct
2 Incorrect 742 ms 876 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 655 ms 1024 KB Wrong query response.
2 Halted 0 ms 0 KB -