Submission #1095966

# Submission time Handle Problem Language Result Execution time Memory
1095966 2024-10-03T13:42:20 Z Newtonabc Stations (IOI20_stations) C++14
0 / 100
627 ms 684 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+10;
int tmpcase1,cnt=0,root;
vector<int> adj[N],lb;
void dfs(int u,int p){
	for(int i=0;i<adj[u].size();i++){
		int v=adj[u][i];
		if(v!=p) dfs(v,u);
	}
	lb[u]=cnt++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	lb.resize(n);
	cnt=0;
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	dfs(0,-1);
	for(int i=0;i<n;i++) adj[i].clear();
	/*for(int i=0;i<lb.size();i++) cout<<lb[i] <<" ";
	cout<<"\n\n\n";*/
	return lb;
}

int find_next_station(int s, int t, vector<int> c) {
	//for(int i=0;i<c.size();i++) cout<<c[i] <<" ";
	//cout<<c.size();
	//cout<<"\n";
	int ind=lower_bound(c.begin(),c.end(),t)-c.begin();
	if(ind==c.size()) ind--;
	return c[ind];
	
}

Compilation message

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:8:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for(int i=0;i<adj[u].size();i++){
      |              ~^~~~~~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:33:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  if(ind==c.size()) ind--;
      |     ~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 342 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 306 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 627 ms 684 KB Output is correct
2 Correct 438 ms 684 KB Output is correct
3 Incorrect 404 ms 684 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 353 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -