Submission #423416

# Submission time Handle Problem Language Result Execution time Memory
423416 2021-06-11T05:36:51 Z Belgutei Stations (IOI20_stations) C++17
5 / 100
1097 ms 648 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<n; i++) edge[i].clear();
	for(int i=0; i<n; i++) visited[i]=0;
	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;
		}
	}
	std::vector<int> labels(n);
	int cnt=0;
	while(visited[pos]==0){
		labels[pos]=cnt;
		visited[pos]=1;
		for(int i=0; i<edge[pos].size(); i++){
			if(visited[edge[pos][i]]==0){
				pos=edge[pos][i];
				break;
			}
		}
		cnt++;
	}
	/*
	cout<<"\n";
	for(int i=0; i<n; i++){
		cout<<labels[i]<<" ";
	}
	*/
	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:19:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=0; i<u.size(); i++){
      |               ~^~~~~~~~~
stations.cpp:35:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for(int i=0; i<edge[pos].size(); i++){
      |                ~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 627 ms 592 KB Output is correct
2 Correct 544 ms 488 KB Output is correct
3 Correct 1097 ms 492 KB Output is correct
4 Correct 889 ms 400 KB Output is correct
5 Correct 670 ms 400 KB Output is correct
6 Correct 505 ms 528 KB Output is correct
7 Correct 521 ms 500 KB Output is correct
8 Correct 3 ms 480 KB Output is correct
9 Correct 5 ms 476 KB Output is correct
10 Correct 1 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 659 ms 648 KB Output is correct
2 Correct 545 ms 528 KB Output is correct
3 Correct 999 ms 520 KB Output is correct
4 Correct 836 ms 400 KB Output is correct
5 Correct 677 ms 516 KB Output is correct
6 Correct 596 ms 508 KB Output is correct
7 Correct 498 ms 552 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=1, label=0
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 994 ms 400 KB Output is correct
2 Correct 706 ms 516 KB Output is correct
3 Correct 683 ms 580 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Incorrect 1 ms 300 KB Invalid labels (duplicates values). scenario=0, label=0
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 670 ms 588 KB Output is correct
2 Correct 560 ms 508 KB Output is correct
3 Correct 1010 ms 508 KB Output is correct
4 Correct 709 ms 516 KB Output is correct
5 Correct 664 ms 400 KB Output is correct
6 Correct 521 ms 488 KB Output is correct
7 Correct 536 ms 512 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 464 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Incorrect 4 ms 328 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -