QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#498934 | #1139. Stations | Dan4Life# | 0 | 0ms | 3960kb | C++23 | 1.3kb | 2024-07-30 21:54:09 | 2024-07-30 21:54:09 |
stations
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
using vi = vector<int>;
const int mxN = 1010;
vi labels;
int dfs_timer = 0;
vi adj[mxN];
void dfs(int s, int p){
labels[s] = dfs_timer++;
for(auto u : adj[s])
if(u!=p) dfs(u,s);
labels[s]*=1000; labels[s]+=dfs_timer;
}
vi label(int n, int k, vi u, vi v) {
labels.clear();
labels.resize(n,0); dfs_timer=0;
for(int i = 0; i < n; i++) adj[i].clear();
for(int i = 0; i < sz(u); i++){
int a = u[i], b = v[i];
adj[a].pb(b), adj[b].pb(a);
}
dfs(0,-1);
for(int i = 0; i < n; i++){
int stS = i/1000, enS = i%1000;
cout << stS << " " << enS << "\n";
}
return labels;
}
int isAnc(int s, int t){
int stS = s/1000, enS = s%1000;
int stT = t/1000, enT = t%1000;
return stS<=stT and enS>=enT;
}
int find_next_station(int s, int t, vi c) {
for(auto u : c) if(u==t) return u;
int par;
for(int i = 0; i < sz(c); i++){
if(isAnc(c[i],s)){
par=c[i]; continue;
}
if(isAnc(c[i],t)) return c[i];
}
return par;/*
if(t < s) return c[0];
int pos = lower_bound(all(c),t+1)-begin(c)-1;
if(pos!=-1 and pos<sz(c)-1) return c[pos];
if() return c[0];
return c.back();*/
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3960kb
input:
0 10 10 1000 4 5 9 0 2 6 5 2 8 3 1 4 8 1 6 0 3 7 3 1000 0 1 1 2 998 1000 166 178 393 452 389 179 622 429 892 866 872 18 899 227 835 637 587 769 504 386 369 577 65 441 523 17 803 221 878 321 637 892 696 473 16 146 840 322 495 986 353 275 330 585 831 402 719 810 704 830 780 940 53 901 894 911 394 482 ...
output:
0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 10 10 6010 3010 8010 5010 4010 2010 9010 7010 1002 0 0 0 1 0 2 3 3 1003 2003 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 3...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
0 10 996 1000 0 1 2 0 1 3 4 1 5 2 6 2 7 3 3 8 4 9 10 4 11 5 12 5 6 13 14 6 7 15 7 16 17 8 18 8 19 9 9 20 21 10 10 22 23 11 24 11 12 25 26 12 27 13 13 28 14 29 30 14 15 31 15 32 16 33 34 16 35 17 17 36 18 37 38 18 39 19 40 19 41 20 42 20 43 21 44 21 45 22 46 22 23 47 48 23 49 24 24 50 25 51 52 25 26 ...
output:
0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 61 ...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #3:
score: 0
Wrong Answer
Test #17:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
0 10 2 1000000 1 0 997 1000000 830 513 223 672 727 200 763 415 581 440 34 42 267 325 912 693 753 59 401 289 198 641 982 214 41 49 453 107 940 806 905 732 153 482 248 405 102 79 480 837 534 620 564 856 679 178 278 247 899 206 333 672 297 308 407 863 26 752 272 178 204 603 208 10 715 562 785 285 184 5...
output:
0 0 0 1 2 2 1002 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 5...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #4:
score: 0
Wrong Answer
Test #34:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
0 10 2 1000000000 0 1 2 1000000000 0 1 2 1000000000 1 0 2 1000000000 1 0 2 1000000000 0 1 2 1000000000 1 0 2 1000000000 1 0 2 1000000000 0 1 2 1000000000 0 1 2 1000000000 0 1
output:
0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002 0 0 0 1 2 2 1002
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #5:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
0 10 3 1000000000 1 0 2 1 998 1000000000 928 443 90 795 55 379 957 417 759 300 960 136 309 858 833 370 228 827 876 955 619 365 15 108 243 388 54 925 141 894 272 634 0 989 600 346 380 277 350 113 326 613 975 946 660 98 34 538 220 864 9 585 185 860 458 424 509 14 22 275 109 872 153 233 76 834 972 736 ...
output:
0 0 0 1 0 2 3 3 1003 2003 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)