# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1095437 |
2024-10-02T07:50:14 Z |
dosts |
Stations (IOI20_stations) |
C++17 |
|
626 ms |
1188 KB |
//Dost SEFEROĞLU
#include <bits/stdc++.h>
#include "stations.h"
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
using namespace std;
//#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int N = 1000;
vi edges[N];
vi ls(N),tin(N),tout(N);
int timer = 1;
void dfs(int node,int p,int deppy = 0) {
tin[node] = timer++;
for (int it : edges[node]) if (it != p) dfs(it,node,deppy^1);
tout[node] = timer++;
if (deppy) ls[node] = tout[node];
else ls[node] = tin[node];
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vi labels(n);
for (int i=0;i<n-1;i++) {
edges[u[i]].push_back(v[i]);
edges[v[i]].push_back(u[i]);
}
dfs(0,0);
for (int i=0;i<n;i++) labels[i] = ls[i];
timer = 1;
for (int i=0;i<n;i++) edges[i].clear();
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
bool ins = 0;
if (c[0] > s) ins = 1;
if (ins) {
//tin bu
int mx = 0;
//mx parentim
if (s != 1) mx = c.back();
int prv = s;
for (int it : c) {
if (it == mx) return it;
int onuntini = prv+1;
prv = it;
if (onuntini <= t && it >= t) return it;
}
return -1;
}
else {
//tout bu
reverse(all(c));
int mn = c.back();
int prv = s+1;
for (int it : c) {
if (it == mn) return it;
int onuntoutu = prv-1;
prv = it;
if (onuntoutu >= t && it <= t) return it;
}
return -1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1991 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
344 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1023 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
390 ms |
940 KB |
Output is correct |
2 |
Correct |
310 ms |
936 KB |
Output is correct |
3 |
Correct |
591 ms |
684 KB |
Output is correct |
4 |
Correct |
450 ms |
684 KB |
Output is correct |
5 |
Correct |
389 ms |
684 KB |
Output is correct |
6 |
Correct |
312 ms |
940 KB |
Output is correct |
7 |
Correct |
285 ms |
684 KB |
Output is correct |
8 |
Correct |
1 ms |
764 KB |
Output is correct |
9 |
Correct |
2 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
1016 KB |
Output is correct |
11 |
Correct |
416 ms |
804 KB |
Output is correct |
12 |
Correct |
294 ms |
1060 KB |
Output is correct |
13 |
Correct |
299 ms |
1036 KB |
Output is correct |
14 |
Correct |
316 ms |
684 KB |
Output is correct |
15 |
Correct |
23 ms |
768 KB |
Output is correct |
16 |
Correct |
33 ms |
764 KB |
Output is correct |
17 |
Correct |
87 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
624 ms |
688 KB |
Output is correct |
2 |
Correct |
450 ms |
684 KB |
Output is correct |
3 |
Correct |
383 ms |
684 KB |
Output is correct |
4 |
Correct |
1 ms |
764 KB |
Output is correct |
5 |
Correct |
1 ms |
776 KB |
Output is correct |
6 |
Correct |
0 ms |
788 KB |
Output is correct |
7 |
Correct |
406 ms |
684 KB |
Output is correct |
8 |
Correct |
626 ms |
684 KB |
Output is correct |
9 |
Correct |
439 ms |
684 KB |
Output is correct |
10 |
Correct |
371 ms |
684 KB |
Output is correct |
11 |
Correct |
3 ms |
776 KB |
Output is correct |
12 |
Correct |
2 ms |
768 KB |
Output is correct |
13 |
Correct |
1 ms |
776 KB |
Output is correct |
14 |
Correct |
1 ms |
776 KB |
Output is correct |
15 |
Correct |
0 ms |
776 KB |
Output is correct |
16 |
Correct |
311 ms |
684 KB |
Output is correct |
17 |
Correct |
313 ms |
684 KB |
Output is correct |
18 |
Correct |
317 ms |
684 KB |
Output is correct |
19 |
Correct |
326 ms |
684 KB |
Output is correct |
20 |
Correct |
321 ms |
684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
343 ms |
936 KB |
Partially correct |
2 |
Partially correct |
318 ms |
940 KB |
Partially correct |
3 |
Correct |
568 ms |
684 KB |
Output is correct |
4 |
Correct |
409 ms |
684 KB |
Output is correct |
5 |
Correct |
392 ms |
684 KB |
Output is correct |
6 |
Partially correct |
285 ms |
936 KB |
Partially correct |
7 |
Partially correct |
309 ms |
684 KB |
Partially correct |
8 |
Correct |
1 ms |
768 KB |
Output is correct |
9 |
Correct |
1 ms |
772 KB |
Output is correct |
10 |
Correct |
1 ms |
768 KB |
Output is correct |
11 |
Partially correct |
302 ms |
684 KB |
Partially correct |
12 |
Partially correct |
323 ms |
684 KB |
Partially correct |
13 |
Correct |
595 ms |
684 KB |
Output is correct |
14 |
Correct |
449 ms |
684 KB |
Output is correct |
15 |
Correct |
380 ms |
684 KB |
Output is correct |
16 |
Partially correct |
284 ms |
684 KB |
Partially correct |
17 |
Correct |
363 ms |
684 KB |
Output is correct |
18 |
Partially correct |
313 ms |
796 KB |
Partially correct |
19 |
Partially correct |
312 ms |
1188 KB |
Partially correct |
20 |
Partially correct |
298 ms |
684 KB |
Partially correct |
21 |
Correct |
34 ms |
772 KB |
Output is correct |
22 |
Partially correct |
36 ms |
764 KB |
Partially correct |
23 |
Partially correct |
54 ms |
880 KB |
Partially correct |
24 |
Correct |
2 ms |
764 KB |
Output is correct |
25 |
Correct |
2 ms |
768 KB |
Output is correct |
26 |
Correct |
4 ms |
768 KB |
Output is correct |
27 |
Correct |
2 ms |
768 KB |
Output is correct |
28 |
Correct |
1 ms |
764 KB |
Output is correct |
29 |
Correct |
347 ms |
808 KB |
Output is correct |
30 |
Correct |
340 ms |
684 KB |
Output is correct |
31 |
Correct |
352 ms |
684 KB |
Output is correct |
32 |
Correct |
323 ms |
688 KB |
Output is correct |
33 |
Correct |
334 ms |
684 KB |
Output is correct |
34 |
Partially correct |
203 ms |
912 KB |
Partially correct |
35 |
Partially correct |
287 ms |
1064 KB |
Partially correct |
36 |
Partially correct |
262 ms |
932 KB |
Partially correct |
37 |
Partially correct |
280 ms |
800 KB |
Partially correct |
38 |
Partially correct |
290 ms |
816 KB |
Partially correct |
39 |
Partially correct |
293 ms |
1056 KB |
Partially correct |
40 |
Partially correct |
294 ms |
804 KB |
Partially correct |
41 |
Partially correct |
285 ms |
796 KB |
Partially correct |
42 |
Partially correct |
26 ms |
760 KB |
Partially correct |
43 |
Partially correct |
58 ms |
744 KB |
Partially correct |
44 |
Partially correct |
74 ms |
744 KB |
Partially correct |
45 |
Partially correct |
87 ms |
684 KB |
Partially correct |
46 |
Partially correct |
208 ms |
684 KB |
Partially correct |
47 |
Partially correct |
196 ms |
684 KB |
Partially correct |
48 |
Partially correct |
37 ms |
768 KB |
Partially correct |
49 |
Partially correct |
31 ms |
1024 KB |
Partially correct |