Submission #320155

# Submission time Handle Problem Language Result Execution time Memory
320155 2020-11-07T19:03:55 Z nickmet2004 Stations (IOI20_stations) C++14
0 / 100
896 ms 1088 KB
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
const int N = 1005;
vector<int> adj[N];
int dtime;
void dfs(int u , vector<int> &R ,int p = -1){
    R[u] =1000 * dtime; dtime++;
    for(int v : adj[u])if(v ^ p)dfs(v ,R , u);
    R[u] += dtime;
}
vector<int> label(int n , int k ,vector<int> u , vector<int> v){
    for(int i = 0; i < n; ++i) adj[i].clear();
    for(int i = 0; i < n-1; ++i) adj[u[i]].emplace_back(v[i]) , adj[v[i]].emplace_back(u[i]);
    vector<int> R(n);
    dtime =0;
    dfs(0 , R);
    return R;
}
int find_next_station(int s , int t , vector<int> c){
    reverse(c.begin() , c.end());
    for(int x : c){
        int in = x / 1000 , out = x % 1000;
        if(in <= t && t <= out) return x;
    }
    return c.back();
}
/*
int main (){
    cin >> n;
    for(int i =1; i < n; ++i){
        int u , v; cin >> u>> v;
        adj[u].emplace_back(v); adj[v].emplace_back(u);
    }
    vector<int> k = label(n , 1 , {3} , {3});
    cout << find_next_station(1 , 3 , {3 , 2 ,0}) << endl;
}
*/
//int main (){}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6010
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 364 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1512
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 552 ms 1088 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 896 ms 896 KB Output is correct
2 Incorrect 761 ms 992 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 601 ms 1024 KB Wrong query response.
2 Halted 0 ms 0 KB -