Submission #319938

# Submission time Handle Problem Language Result Execution time Memory
319938 2020-11-06T21:13:30 Z nickmet2004 Stations (IOI20_stations) C++14
0 / 100
2 ms 752 KB
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
const int N = 1505;
vector<int> adj[N];
int tin[N] , tout[N] , dtime;
vector<int> R;
void dfs(int u , int p = -1){
    R[u] =tin[u] = dtime++;
    for(int v : adj[u]){
        if(v==p)continue;
        dfs(v  ,u);
    }
    tout[u]= dtime;
}
vector<int> label(int n , int k ,vector<int> u , vector<int> v){
    for(int i = 0; i < n; ++i) adj[u[i]].emplace_back(v[i]) , adj[v[i]].emplace_back(u[i]);
    dfs(0);
    R.resize(n);
    return R;
}
bool cmp(int a, int b){
    return tin[a] < tin[b];
}
int find_next_station(int s , int t , vector<int> c){
    sort(c.begin() , c.end() , cmp);
    for(int u : c){
        if(tin[u] <= tin[t] && tout[t] <= tout[u]) return u;
    }
    return c[0];
}

# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 752 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 Runtime error 2 ms 620 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 Runtime error 1 ms 484 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 Runtime error 1 ms 484 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 Runtime error 1 ms 544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -