# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
306920 | giorgikob | Stations (IOI20_stations) | C++14 | 1008 ms | 868 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
const int N = 1e3+5;
vector<int>gr[N];
int cnt = 0;
int fix[N];
//int c = 0;
void dfs(int x, vector<int>&v){
fix[x] = 1;
for(auto to : gr[x]){
if(fix[to]) continue;
dfs(to,v);
}
v[x] = cnt; cnt++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n,0);
//for(int i = 0; i < n; i ++ ) labels[i] = i;
for(int i = 0; i < u.size(); i++){
int x = u[i];
int y = v[i];
gr[x].pb(y);
gr[y].pb(x);
}
if(k == 1000) cnt = 0;
dfs(0,labels);
for(int i = 0; i < n; i++) gr[i].clear(), fix[i] = 0;
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
//if(c.size() == 1) return c[0];
//if(s > t) return c[0];
if(s < t) return c.back();
for(int i = 0; i < c.size() - 1; i++){
if(c[i] >= t)
return c[i];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |