# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871420 | 2023-11-10T19:17:16 Z | andrei_boaca | Stations (IOI20_stations) | C++17 | 564 ms | 1820 KB |
#include "stations.h" #include <bits/stdc++.h> #include <vector> //#include "stub.cpp" using namespace std; const int baza=1e8; vector<int> muchii[1005]; int in[1005],out[1005],timp,niv[1005]; bool use[1005]; int n,k; vector<int> L; int ch,ind; int lin[10005]; void dfs(int nod) { timp++; lin[timp]=nod; in[nod]=timp; use[nod]=1; for(int i:muchii[nod]) if(!use[i]) { niv[i]=niv[nod]+1; dfs(i); } timp++; lin[timp]=nod; out[nod]=timp; } std::vector<int> label(int N, int K, std::vector<int> u, std::vector<int> v) { n=N; k=K; L.clear(); L.resize(n); timp=0; for(int i=0;i<n;i++) { use[i]=0; muchii[i].clear(); } for(int i=0;i<u.size();i++) { int a=u[i]; int b=v[i]; muchii[a].push_back(b); muchii[b].push_back(a); } niv[0]=1; dfs(0); vector<int> ord; for(int i=1;i<=timp;i++) { int nod=lin[i]; if(niv[nod]%2==1) { if(in[nod]==i) ord.push_back(nod); } if(niv[nod]%2==0) { if(out[nod]==i) ord.push_back(nod); } } for(int i=0;i<ord.size();i++) L[ord[i]]=i; return L; } int find_next_station(int s, int t, std::vector<int> c) { if(c.size()==1) return c[0]; if(c[0]>s) { for(int i=0;i+1<c.size();i++) if(s<=t&&t<=c[i]) return c[i]; return c.back(); } else { for(int i=(int)c.size()-1;i>0;i--) if(c[i]<=t&&t<=s) return c[i]; return c[0]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 315 ms | 936 KB | Output is correct |
2 | Correct | 259 ms | 952 KB | Output is correct |
3 | Correct | 515 ms | 696 KB | Output is correct |
4 | Correct | 392 ms | 684 KB | Output is correct |
5 | Correct | 315 ms | 844 KB | Output is correct |
6 | Correct | 255 ms | 936 KB | Output is correct |
7 | Correct | 253 ms | 684 KB | Output is correct |
8 | Correct | 1 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 1016 KB | Output is correct |
10 | Correct | 1 ms | 772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 245 ms | 896 KB | Output is correct |
2 | Correct | 303 ms | 828 KB | Output is correct |
3 | Correct | 518 ms | 940 KB | Output is correct |
4 | Correct | 386 ms | 684 KB | Output is correct |
5 | Correct | 341 ms | 688 KB | Output is correct |
6 | Correct | 256 ms | 688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 307 ms | 956 KB | Output is correct |
2 | Correct | 252 ms | 940 KB | Output is correct |
3 | Correct | 498 ms | 684 KB | Output is correct |
4 | Correct | 353 ms | 684 KB | Output is correct |
5 | Correct | 339 ms | 684 KB | Output is correct |
6 | Correct | 270 ms | 932 KB | Output is correct |
7 | Correct | 239 ms | 684 KB | Output is correct |
8 | Correct | 1 ms | 760 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 1 ms | 764 KB | Output is correct |
11 | Correct | 343 ms | 684 KB | Output is correct |
12 | Correct | 275 ms | 1316 KB | Output is correct |
13 | Correct | 246 ms | 1820 KB | Output is correct |
14 | Correct | 229 ms | 684 KB | Output is correct |
15 | Correct | 33 ms | 684 KB | Output is correct |
16 | Correct | 37 ms | 868 KB | Output is correct |
17 | Correct | 65 ms | 976 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 511 ms | 684 KB | Output is correct |
2 | Correct | 468 ms | 684 KB | Output is correct |
3 | Correct | 393 ms | 684 KB | Output is correct |
4 | Correct | 2 ms | 768 KB | Output is correct |
5 | Correct | 2 ms | 768 KB | Output is correct |
6 | Correct | 0 ms | 768 KB | Output is correct |
7 | Correct | 379 ms | 800 KB | Output is correct |
8 | Correct | 564 ms | 684 KB | Output is correct |
9 | Correct | 391 ms | 688 KB | Output is correct |
10 | Correct | 393 ms | 684 KB | Output is correct |
11 | Correct | 3 ms | 772 KB | Output is correct |
12 | Correct | 2 ms | 768 KB | Output is correct |
13 | Correct | 2 ms | 768 KB | Output is correct |
14 | Correct | 1 ms | 768 KB | Output is correct |
15 | Correct | 0 ms | 768 KB | Output is correct |
16 | Correct | 281 ms | 684 KB | Output is correct |
17 | Correct | 293 ms | 684 KB | Output is correct |
18 | Correct | 293 ms | 684 KB | Output is correct |
19 | Correct | 261 ms | 684 KB | Output is correct |
20 | Correct | 297 ms | 684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 320 ms | 956 KB | Output is correct |
2 | Correct | 237 ms | 940 KB | Output is correct |
3 | Correct | 471 ms | 684 KB | Output is correct |
4 | Correct | 350 ms | 840 KB | Output is correct |
5 | Correct | 321 ms | 684 KB | Output is correct |
6 | Correct | 260 ms | 920 KB | Output is correct |
7 | Correct | 288 ms | 684 KB | Output is correct |
8 | Correct | 1 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 0 ms | 764 KB | Output is correct |
11 | Correct | 272 ms | 896 KB | Output is correct |
12 | Correct | 303 ms | 1116 KB | Output is correct |
13 | Correct | 517 ms | 684 KB | Output is correct |
14 | Correct | 390 ms | 684 KB | Output is correct |
15 | Correct | 341 ms | 684 KB | Output is correct |
16 | Correct | 247 ms | 684 KB | Output is correct |
17 | Correct | 313 ms | 684 KB | Output is correct |
18 | Correct | 258 ms | 1056 KB | Output is correct |
19 | Correct | 281 ms | 1312 KB | Output is correct |
20 | Correct | 257 ms | 684 KB | Output is correct |
21 | Correct | 33 ms | 764 KB | Output is correct |
22 | Correct | 37 ms | 940 KB | Output is correct |
23 | Correct | 60 ms | 1216 KB | Output is correct |
24 | Correct | 4 ms | 768 KB | Output is correct |
25 | Correct | 3 ms | 768 KB | Output is correct |
26 | Correct | 2 ms | 768 KB | Output is correct |
27 | Correct | 2 ms | 1016 KB | Output is correct |
28 | Correct | 0 ms | 768 KB | Output is correct |
29 | Correct | 291 ms | 684 KB | Output is correct |
30 | Correct | 288 ms | 684 KB | Output is correct |
31 | Correct | 299 ms | 732 KB | Output is correct |
32 | Correct | 270 ms | 684 KB | Output is correct |
33 | Correct | 311 ms | 684 KB | Output is correct |
34 | Correct | 168 ms | 932 KB | Output is correct |
35 | Correct | 242 ms | 1088 KB | Output is correct |
36 | Correct | 255 ms | 944 KB | Output is correct |
37 | Correct | 256 ms | 1040 KB | Output is correct |
38 | Correct | 243 ms | 1184 KB | Output is correct |
39 | Correct | 265 ms | 1304 KB | Output is correct |
40 | Correct | 220 ms | 1056 KB | Output is correct |
41 | Correct | 255 ms | 1040 KB | Output is correct |
42 | Correct | 40 ms | 872 KB | Output is correct |
43 | Correct | 57 ms | 900 KB | Output is correct |
44 | Correct | 68 ms | 916 KB | Output is correct |
45 | Correct | 85 ms | 924 KB | Output is correct |
46 | Correct | 176 ms | 880 KB | Output is correct |
47 | Correct | 161 ms | 908 KB | Output is correct |
48 | Correct | 30 ms | 1468 KB | Output is correct |
49 | Correct | 33 ms | 1500 KB | Output is correct |