# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
350644 |
2021-01-19T07:11:19 Z |
Kerim |
Stations (IOI20_stations) |
C++17 |
|
1061 ms |
992 KB |
#include "stations.h"
#include "bits/stdc++.h"
#define MAXN 1009
#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;T=0;
for(int i=0;i<n;i++)
adj[i].clear();
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 |
Incorrect |
685 ms |
864 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
535 ms |
768 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
622 ms |
992 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1061 ms |
864 KB |
Output is correct |
2 |
Incorrect |
690 ms |
896 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
692 ms |
896 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |