#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std ;
const int N = 1e3 + 3 ;
vector<int> adj[N];
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
for(int i = 0 ;i < n; i ++)adj[i].clear();
// clear
for(int i = 0 ; i < n - 1 ; i ++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
for(int i = 0 ; i < n ; i ++){
string s = "" ;
for(auto f : adj[i])s.push_back(f + 48);
s.push_back(i + 48);
while(s.size() < 8)s.insert(0 , "9");
labels[i] = stoi(s);
}
return labels;
}
int find_next_station(int s, int t,vector<int> c) {
for(auto f : c){
map<int , int > mp ;
int tmp ;
tmp = t ;
while(tmp){
mp[tmp % 10] ++ ;
tmp /= 10;
}
mp.erase(9);
tmp = f ;
while(tmp){
if(mp.count(tmp % 10) && tmp % 10 != s % 10){
return f ;
}
tmp /= 10 ;
}
}
return c[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
328 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=99999960 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
312 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=99999120 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
308 KB |
Invalid labels (values out of range). scenario=0, k=1000000, vertex=0, label=99999910 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
910 ms |
400 KB |
Output is correct |
2 |
Correct |
723 ms |
536 KB |
Output is correct |
3 |
Correct |
640 ms |
536 KB |
Output is correct |
4 |
Correct |
3 ms |
476 KB |
Output is correct |
5 |
Correct |
4 ms |
448 KB |
Output is correct |
6 |
Correct |
2 ms |
472 KB |
Output is correct |
7 |
Correct |
640 ms |
400 KB |
Output is correct |
8 |
Correct |
886 ms |
400 KB |
Output is correct |
9 |
Correct |
674 ms |
536 KB |
Output is correct |
10 |
Correct |
671 ms |
400 KB |
Output is correct |
11 |
Correct |
6 ms |
420 KB |
Output is correct |
12 |
Correct |
7 ms |
468 KB |
Output is correct |
13 |
Incorrect |
5 ms |
472 KB |
Wrong query response. |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
312 KB |
Invalid labels (duplicates values). scenario=1, label=99999 |
2 |
Halted |
0 ms |
0 KB |
- |