Submission #330335

# Submission time Handle Problem Language Result Execution time Memory
330335 2020-11-24T20:02:19 Z marvenlee Stations (IOI20_stations) C++14
0 / 100
5 ms 364 KB
#include "stations.h"
#include <vector>
using namespace std;

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	std::vector<int> labels(n);
    vector< vector<int> > graph(n,vector<int>());
    for(int i=0;i<n-1;i++){
        graph[u[i]].push_back(v[i]);
        graph[v[i]].push_back(u[i]);
    }
    int s=0;
    for(int i=0;i<n-1;i++){
        if(graph[i].size()==1) {s=i;break;}
    }
    int b;
    for(int i=0;i<n-1;i++){
        labels[s]=i;
        b=s;
        for(auto j=graph[b].begin(); j!=graph[b].end();j++){
            if(*j!=b) s=*j;
        }
    }
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(c[0]<c[1]){
        int temp=c[0];
        c[0]=c[1];
        c[1]=temp;
    }
	return (s<t)?c[1]:c[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 364 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 364 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 364 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 364 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 364 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -