Submission #529556

# Submission time Handle Problem Language Result Execution time Memory
529556 2022-02-23T07:22:06 Z pokmui9909 Stations (IOI20_stations) C++17
0 / 100
4 ms 524 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll in[1005], out[1005];
vector<ll> T[1005];
ll num = -1;
void dfs(ll u, ll p){
	in[u] = ++num;
	for(auto v : T[u]){
		if(v == p) continue;
		dfs(v, u);
	}
	out[u] = num;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	for(int i = 0; i < n - 1; i++){
		T[u[i]].push_back(v[i]);
		T[v[i]].push_back(u[i]);
	}
	//dfs(0, -1);
	vector<int> L(n);
	for(int i = 0; i < n; i++){
		L[i] = in[i] * 1000 + out[i];
	}
	return L;
}
int find_next_station(int s, int t, std::vector<int> c) {
	ll ls = s / 1000, rs = s % 1000, lt = t / 1000, rt = t % 1000;
	for(int i = 0; i < c.size(); i++){
		ll k = c[i];
		ll lk = k / 1000, rk = k % 1000;
		if(lk <= lt && rt <= rk) return k;
	}
	return -1;
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i = 0; i < c.size(); i++){
      |                 ~~^~~~~~~~~~
stations.cpp:30:5: warning: unused variable 'ls' [-Wunused-variable]
   30 |  ll ls = s / 1000, rs = s % 1000, lt = t / 1000, rt = t % 1000;
      |     ^~
stations.cpp:30:20: warning: unused variable 'rs' [-Wunused-variable]
   30 |  ll ls = s / 1000, rs = s % 1000, lt = t / 1000, rt = t % 1000;
      |                    ^~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 456 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 456 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 440 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 524 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -