Submission #417666

# Submission time Handle Problem Language Result Execution time Memory
417666 2021-06-04T06:09:24 Z lakshith_ Stations (IOI20_stations) C++14
5 / 100
885 ms 620 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

#define what_is(a) cout << #a << " is " << a << "\n"
#define checker(a) cout << "checker reached " << a << "\n"

vector<int> path;

void dfs(int u,int p,vector<vector<int>>& adj){
	path.push_back(u);
	for(int v:adj[u])
		if(v!=p)dfs(v,u,adj);
	//what_is(u);
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<int> labels;
	int counts[n];
	vector<vector<int>> adj(1000,vector<int>());
	memset(counts,0,sizeof(counts));
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
		counts[u[i]]++,counts[v[i]]++;
	}
	int start = 0;
	for(int i=0;i<n;i++){
		if(counts[i]==1){
			start = i;
			break;
		}
	}
	path.clear();
	dfs(start,-1,adj);
	labels.assign(n,0);
	for(int i=0;i<n;i++)
		labels[path[i]] = i;
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(c.size()!=2)return c[0];
	if(s<=t)
		return max(c[0],c[1]);
	else
		return min(c[0],c[1]);
}
# Verdict Execution time Memory Grader output
1 Correct 588 ms 612 KB Output is correct
2 Correct 419 ms 620 KB Output is correct
3 Correct 818 ms 400 KB Output is correct
4 Correct 618 ms 488 KB Output is correct
5 Correct 579 ms 528 KB Output is correct
6 Correct 418 ms 608 KB Output is correct
7 Correct 430 ms 612 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 4 ms 596 KB Output is correct
10 Correct 1 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 428 ms 484 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 489 ms 612 KB Output is correct
2 Correct 433 ms 528 KB Output is correct
3 Correct 825 ms 496 KB Output is correct
4 Correct 613 ms 400 KB Output is correct
5 Correct 616 ms 528 KB Output is correct
6 Correct 464 ms 608 KB Output is correct
7 Correct 447 ms 596 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 4 ms 576 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Incorrect 535 ms 468 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 885 ms 552 KB Output is correct
2 Correct 606 ms 496 KB Output is correct
3 Correct 618 ms 488 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 3 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Incorrect 482 ms 484 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 521 ms 612 KB Output is correct
2 Correct 464 ms 612 KB Output is correct
3 Correct 801 ms 528 KB Output is correct
4 Correct 687 ms 612 KB Output is correct
5 Correct 604 ms 516 KB Output is correct
6 Correct 431 ms 616 KB Output is correct
7 Correct 380 ms 520 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 5 ms 592 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Incorrect 438 ms 468 KB Wrong query response.
12 Halted 0 ms 0 KB -