Submission #320145

# Submission time Handle Problem Language Result Execution time Memory
320145 2020-11-07T18:47:52 Z nickmet2004 Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
const int N = 100005;
int n;
vector<int> adj[N] , R;
int dtime;
void dfs(int u , int p = -1){
    R[u] =1000 * dtime; dtime++;
    for(int v : adj[u])if(v ^ p)dfs(v ,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; ++i) adj[u[i]].emplace_back(v[i]) , adj[v[i]].emplace_back(u[i]);
    R.resize(n);
    dfs(0);
    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[c.size() - 1];
}
/*
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 Runtime error 2486 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 5356 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3122 ms 1050480 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 953 ms 5536 KB Output is correct
2 Incorrect 916 ms 5500 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 5356 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -