#include "stations.h"
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
const int N=1e3+10;
vi graf[N];
int val[N],li,kol[N];
void dfs(int v,int o){
li++;
if(!kol[v]) val[v]=li;
for(auto u:graf[v]){
if(u==o) continue;
kol[u]=kol[v]^1;
dfs(u,v);
}
li++;
if(kol[v]) val[v]=li;
}
vi label(int n, int k, vi a,vi b) {
for(int i=0;i<n;i++)
graf[a[i]].push_back(b[i]),graf[b[i]].push_back(a[i]);
dfs(0,0);
vector<pair<int,int>> v;
for(int i=0;i<n;i++) v.push_back({val[i],i});
sort(v.begin(),v.end());
vi res(n);
for(int i=0;i<n;i++) res[v[i].se]=i;
return res;
}
int find_next_station(int s,int t,vi c) {
if(c.size()==1) return c[0];
if(c[0]>s){
// pre
if(s==0){
for(auto u:c){
if(u>=t) return u;
}
return 0;
}
if(t>=s and t<=c[c.size()-2]){
for(auto u:c){
if(u>=t) return u;
}
return 0;
}return c[c.size()-1];
}else{
if(t>c[0] and t<=s){
int ost=0;
for(int i=1;i<(int)c.size();i++){
if(t>=c[i]) ost=c[i];
}
return ost;
}else return c[0];
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1342 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3059 ms |
85840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1300 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
639 ms |
692 KB |
Output is correct |
2 |
Runtime error |
1087 ms |
2097152 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1135 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |