# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
350621 |
2021-01-19T07:04:58 Z |
Kerim |
Stations (IOI20_stations) |
C++17 |
|
3000 ms |
2097156 KB |
#include "stations.h"
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x) cerr<< #x <<" = "<< x<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int n;
int tin[MAXN],tout[MAXN],T;
vector<int>adj[MAXN];
void dfs(int nd,int pr){
tin[nd]=T++;
tr(it,adj[nd])
if(*it!=pr)
dfs(*it,nd);
tout[nd]=T++;
}
vector<int> label(int N, int k,vector<int> u, std::vector<int> v) {
n=N;
for(int i=0;i<n-1;i++){
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
}
vector<int> labels(n);
for (int i = 0; i < n; i++) {
labels[i] = i;
}
dfs(0,-1);
return labels;
}
bool ata(int x,int y){
return (tin[x]<tin[y] and tout[y]<tout[x]);
}
int find_next_station(int s, int t, vector<int> c) {
tr(it,c)
if(ata(s,*it) and (ata(*it,t) or *it==t))
return *it;
tr(it,c)
if(ata(*it,s))
return *it;
return c[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1488 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 |
Execution timed out |
3035 ms |
2856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1588 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 |
Correct |
987 ms |
5472 KB |
Output is correct |
2 |
Runtime error |
1226 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2797 ms |
2097156 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |