Submission #385975

# Submission time Handle Problem Language Result Execution time Memory
385975 2021-04-05T10:10:04 Z PedroBigMan Stations (IOI20_stations) C++14
5 / 100
1043 ms 1188 KB
#include "stations.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;
 
template<class A=ll> 
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
 
template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}}
 
vector<ll> label(ll N, ll k, vector<ll> u, vector<ll> v) 
{
	vector<ll> xx; vector<vector<ll> > adj; REP(i,0,N) {adj.pb(xx);}
	REP(i,0,N-1) {adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]);}
	ll beg; REP(i,0,N) {if(adj[i].size()==1) {beg=i; break;}}
	vector<ll> label; REP(i,0,N) {label.pb(-1);}
	ll cur=beg; vector<bool> visited; REP(i,0,N) {visited.pb(false);}
	ll ind = 0;
	REP(i,0,N)
	{
		visited[cur]=true; label[cur]=ind; ind++;
		ll nxt = adj[cur][0]; if(visited[nxt]) {nxt=adj[cur][1];}
		cur=nxt;
	}
	return label;
}
 
ll find_next_station(ll s, ll t, vector<ll> c) 
{
	if(t>s) {return (s+1);} else if(t<s) {return (s-1);} else {return s;}
}

Compilation message

stations.cpp: In function 'std::vector<int> label(ll, ll, std::vector<int>, std::vector<int>)':
stations.cpp:55:14: warning: 'beg' may be used uninitialized in this function [-Wmaybe-uninitialized]
   55 |   visited[cur]=true; label[cur]=ind; ind++;
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 637 ms 736 KB Output is correct
2 Correct 539 ms 772 KB Output is correct
3 Correct 1041 ms 1188 KB Output is correct
4 Correct 698 ms 756 KB Output is correct
5 Correct 652 ms 756 KB Output is correct
6 Correct 588 ms 760 KB Output is correct
7 Correct 519 ms 756 KB Output is correct
8 Correct 3 ms 868 KB Output is correct
9 Correct 6 ms 996 KB Output is correct
10 Correct 3 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 364 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=4, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 646 ms 864 KB Output is correct
2 Correct 525 ms 1028 KB Output is correct
3 Correct 1006 ms 868 KB Output is correct
4 Correct 775 ms 868 KB Output is correct
5 Correct 734 ms 884 KB Output is correct
6 Correct 438 ms 756 KB Output is correct
7 Correct 521 ms 792 KB Output is correct
8 Correct 3 ms 756 KB Output is correct
9 Correct 5 ms 884 KB Output is correct
10 Correct 2 ms 1004 KB Output is correct
11 Incorrect 1 ms 364 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=3, label=-1
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1020 ms 1060 KB Output is correct
2 Correct 691 ms 756 KB Output is correct
3 Correct 687 ms 1060 KB Output is correct
4 Correct 3 ms 736 KB Output is correct
5 Correct 5 ms 868 KB Output is correct
6 Correct 2 ms 868 KB Output is correct
7 Incorrect 1 ms 364 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=2, label=-1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 575 ms 768 KB Output is correct
2 Correct 491 ms 768 KB Output is correct
3 Correct 1043 ms 756 KB Output is correct
4 Correct 790 ms 736 KB Output is correct
5 Correct 683 ms 868 KB Output is correct
6 Correct 500 ms 756 KB Output is correct
7 Correct 524 ms 792 KB Output is correct
8 Correct 3 ms 884 KB Output is correct
9 Correct 6 ms 796 KB Output is correct
10 Correct 2 ms 736 KB Output is correct
11 Incorrect 5 ms 364 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=4, label=-1
12 Halted 0 ms 0 KB -