Submission #423386

# Submission time Handle Problem Language Result Execution time Memory
423386 2021-06-11T04:47:43 Z Belgutei Stations (IOI20_stations) C++17
0 / 100
4 ms 456 KB
#include "stations.h"

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

vector<int> edge[1005];
bool visited[1005];

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	for(int i=0; i<u.size(); i++){
		edge[u[i]].pb(v[i]);
		edge[v[i]].pb(u[i]);
	}
	int pos=0;
	for(int i=0; i<n; i++){
		if(edge[i].size()==1){
			pos=i;
			break;
		}
	}
	int cnt=0;
	std::vector<int> labels(n);
	while(visited[pos]==0){
		visited[pos]=1;
		labels[pos]=cnt;
		for(int i=0; i<edge[pos].size(); i++){
			if(visited[edge[pos][i]]==0){
				pos=edge[pos][i];
				break;
			}
		}
		cnt++;
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(c.size()==1){
		return c[0];
	}
	int mx=max(c[0],c[1]);
	int mn=min(c[0],c[1]);
	if(s>t) return mn;
	else return mx;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(int i=0; i<u.size(); i++){
      |               ~^~~~~~~~~
stations.cpp:33:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   for(int i=0; i<edge[pos].size(); i++){
      |                ~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 456 KB Invalid labels (duplicates values). scenario=1, 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 428 KB Invalid labels (duplicates values). scenario=1, 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=1, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 432 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -