#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+100;
vector<int> ma[N];
vector<int> labels;
void dfs(int x,int v,int p)
{
labels[x]=v;
for(auto y:ma[x])
{
if(y==p)continue;
dfs(y,v+1,x);
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
labels.resize(n,0);
for(int i=0;i<(n);i++)ma[i].clear(),labels[i]=i;
// for(int i=0;i<(n-1);i++)
// {
// ma[u[i]].push_back(v[i]);
// ma[v[i]].push_back(u[i]);
// }
// for(int i=0;i<n;i++)
// {
// if(ma[i].size()==1)
// {
// dfs(i,0,-1);
// }
// }
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
sort(begin(c),end(c));
vector<int> vip={t};
while(t>0)
{
t=(t-1)/2;
vip.push_back(t);
}
for(int j=1;j<vip.size();j++)
if(vip[j]==s)
return vip[j-1];
return (s-1)/2;
}
Compilation message
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:43:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(int j=1;j<vip.size();j++)
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
373 ms |
684 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
319 ms |
688 KB |
Output is correct |
2 |
Correct |
390 ms |
684 KB |
Output is correct |
3 |
Correct |
641 ms |
684 KB |
Output is correct |
4 |
Correct |
438 ms |
684 KB |
Output is correct |
5 |
Correct |
419 ms |
944 KB |
Output is correct |
6 |
Correct |
294 ms |
684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
377 ms |
684 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
555 ms |
684 KB |
Output is correct |
2 |
Incorrect |
451 ms |
684 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
356 ms |
684 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |