#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define what_is(a) cout << #a << " is " << a << "\n"
#define checker(a) cout << "checker reached " << a << "\n"
vector<int> labels;
int col = 0;
void dfs(int u,int p,vector<vector<int>>& adj){
int c = 0;
for(int v:adj[u]){
if(v==p)continue;
c++;
if(c==2)labels[u] = col++;
dfs(v,u,adj);
}
if(labels[u]==-1)labels[u] = col++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
labels.assign(n,-1);
vector<vector<int>> adj(1000,vector<int>());
for(int i=0;i<n-1;i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
col = 0;
dfs(0,-1,adj);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(c.size()==0){
if(s<t)return c[1];
else return c[0];
}
if(c.size()==1)return c[0];
if(s<=t)
return c[3];
else if(t<=c[0])
return c[0];
else
return c[1];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
507 ms |
628 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
442 ms |
480 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
555 ms |
528 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
825 ms |
480 KB |
Output is correct |
2 |
Incorrect |
705 ms |
528 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
530 ms |
520 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |