#ifdef LIS05ST
#define _GLIBCXX_DEBUG
#define _GLIBCXX_DEBUG_PEDANTIC
#endif
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2,popcnt,lzcnt,bmi,bmi2")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const int NMAX=1000;
vector<int>g[NMAX+5];
int p[NMAX+5];
int lbl[NMAX+5];
bool used[NMAX+5];
void dfs(int v,int l){
lbl[v]=l;
used[v]=1;
l*=2;
for(auto u:g[v]){
if(used[u])continue;
dfs(u,++l);
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){
for(int i=0;i<n;i++){
p[i]=0;
used[i]=0;
lbl[i]=0;
g[i].clear();
}
for(int i=0;i<n-1;i++){
g[v[i]].push_back(u[i]);
g[u[i]].push_back(v[i]);
}
dfs(0,0);
vector<int>ans(n);
for(int i=0;i<n;i++)ans[i]=lbl[i];
return ans;
};
bool can(int x,int y){
if(x>y)return 0;
bitset<32>a(x),b(y);
int p1=31;int p2=31;
while(p1>=0&&a[p1]==0)p1--;
while(p2>=0&&b[p2]==0)p2--;
for(int i=p1;i>=0;i--){
if(a[i]==b[p2]){
p2--;
continue;
}else return 0;
}
return 1;
}
int find_next_station(int s, int t, std::vector<int> c){
s++;
t++;
for(auto&e:c)e++;
for(auto u:c){
if(can(s,u)&&can(u,t))return u-1;
}
for(auto u:c){
if(u<s)return u-1;
}
};
#define MULTITESTS false
void solve(int testCase){
}
void precalc(){
}
/*
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
precalc();
int t=1;
if(MULTITESTS)cin>>t;
for(int i=1;i<=t;i++){
auto t1=clock();
solve(i);
auto t2=clock();
float delta=t2-t1;
delta/=CLOCKS_PER_SEC;
#ifdef LIS05ST
cout<<"("<<i<<")------------"<<fixed<<setprecision(2)<<delta<<"s\n";
#endif
}
}*/
Compilation message
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type]
71 | };
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
328 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=2, label=-1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
418 ms |
536 KB |
Output is correct |
2 |
Correct |
549 ms |
548 KB |
Output is correct |
3 |
Correct |
822 ms |
420 KB |
Output is correct |
4 |
Correct |
543 ms |
532 KB |
Output is correct |
5 |
Correct |
608 ms |
416 KB |
Output is correct |
6 |
Correct |
376 ms |
544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=1, label=-1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
663 ms |
540 KB |
Output is correct |
2 |
Correct |
670 ms |
416 KB |
Output is correct |
3 |
Correct |
523 ms |
420 KB |
Output is correct |
4 |
Correct |
3 ms |
500 KB |
Output is correct |
5 |
Correct |
4 ms |
628 KB |
Output is correct |
6 |
Correct |
0 ms |
492 KB |
Output is correct |
7 |
Correct |
501 ms |
536 KB |
Output is correct |
8 |
Correct |
781 ms |
512 KB |
Output is correct |
9 |
Correct |
660 ms |
416 KB |
Output is correct |
10 |
Correct |
543 ms |
532 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
Invalid labels (duplicates values). scenario=2, label=3 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
324 KB |
Invalid labels (values out of range). scenario=1, k=1000000000, vertex=1, label=-1 |
2 |
Halted |
0 ms |
0 KB |
- |