Submission #342385

# Submission time Handle Problem Language Result Execution time Memory
342385 2021-01-02T03:43:55 Z Ta180m Stations (IOI20_stations) C++17
0 / 100
815 ms 1232 KB
#include "stations.h"
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr int MX = 1e3+5;

int cnt = 1;
vector<int> labels, G[MX];

void dfs(int u, int p) {
	for (int v : G[u]) if (v != p) dfs(v, u);
	labels[u] = cnt++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	cnt = 1;
	for (int i = 0; i < n; ++i) G[i].clear();
	for (int i = 0; i < n-1; ++i) {
		G[u[i]].push_back(v[i]);
		G[v[i]].push_back(u[i]);
	}
	labels.clear();
	labels.resize(n, 0);
	dfs(0, -1);
	// for (int x : labels) cout << x << '\n';
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	sort(begin(c), end(c));
	for (int i = 0; i < c.size(); ++i) {
		if (t <= c[i]) return c[i];
	}
	// cout << s << ' ' << t;
	// for (int x : c) cout << ' ' << x;
	// cout << '\n';
	return c.back();
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for (int i = 0; i < c.size(); ++i) {
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 542 ms 1104 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 467 ms 864 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 545 ms 992 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 815 ms 952 KB Output is correct
2 Correct 658 ms 952 KB Output is correct
3 Incorrect 591 ms 952 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 516 ms 1232 KB Wrong query response.
2 Halted 0 ms 0 KB -