/*
{
######################
# Author #
# Gary #
# 2020 #
######################
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
#include "stations.h"
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
vector<int> g[1001];
int id[1001];
int cnt=0;
void run(int now,int pre=0,int depth=1){
if(depth) id[now]=cnt++;
for(auto it:g[now]){
if(it!=pre){
run(it,now,depth^1);
}
}
if(!depth) id[now]=cnt++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
cnt=0;
rep(i,n)
g[i].clear();
rep(i,n-1)
g[u[i]].PB(v[i]),g[v[i]].PB(u[i]);
run(0);
rep(i,n)
labels[i]=id[i];
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(s<c[0]){
if(s==0||(c.size()>=2&&t<=c[c.size()-2])){
return *lower_bound(ALL(c),t);
}
return c.back();
}
else{
if(c.size()>=2&&t>=c[1]){
return *(upper_bound(ALL(c),t)-1);
}
return c[0];
}
return 0;
}
//int main(){
// fastio;
// vector<int>v=label(4, 10, {2, 2,0}, {3, 0, 1});
//// cout<<find_next_station(4,3,{1,3,6})<<endl;
// for(auto it:v) cout<<it<<' ';
// cout<<endl;
// cout<<find_next_station(2,1,{0,1})<<endl;
// return 0;
//}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
601 ms |
1032 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
647 ms |
920 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
542 ms |
1048 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1035 ms |
868 KB |
Output is correct |
2 |
Correct |
636 ms |
768 KB |
Output is correct |
3 |
Incorrect |
629 ms |
768 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
673 ms |
1024 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |