# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
350683 |
2021-01-19T07:22:07 Z |
Kerim |
Stations (IOI20_stations) |
C++17 |
|
988 ms |
1252 KB |
#include "stations.h"
#include "bits/stdc++.h"
#define MAXN 1009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x) cerr<< #x <<" = "<< x<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int tin[MAXN],tout[MAXN],T,n;
vector<int>adj[MAXN],labels;
void dfs(int nd,int pr,int lvl){
tin[nd]=T++;
tr(it,adj[nd])
if(*it!=pr)
dfs(*it,nd,lvl^1);
tout[nd]=T++;
if(lvl)labels[nd]=tout[nd];
else labels[nd]=tin[nd];
}
vector<int> label(int N, int k,vector<int> u, std::vector<int> v) {
n=N;T=0;labels.clear();
labels.resize(n);
for(int i=0;i<n;i++)adj[i].clear();
for(int i=0;i<n-1;i++){
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
}
dfs(0,-1,0);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
sort(all(c));int m=int(c.size());
if(!s){
tr(it,c)
if(t<=*it)
return *it;
}
if(s<c[0]){
int in=s,out=c[m-1]-1;
if(in<t and t<out){
tr(it,c)
if(t<=*it)
return *it;
}
return c.back();
}
else{
int in=c[0]+1,out=s;
if(in<t and t<out){
for(int i=m-1;i>=0;i--)
if(c[i]<=t)
return c[i];
}
return c[0];
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
492 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1990 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
472 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1022 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
634 ms |
992 KB |
Output is correct |
2 |
Correct |
458 ms |
992 KB |
Output is correct |
3 |
Correct |
907 ms |
736 KB |
Output is correct |
4 |
Correct |
708 ms |
944 KB |
Output is correct |
5 |
Correct |
670 ms |
736 KB |
Output is correct |
6 |
Correct |
498 ms |
1040 KB |
Output is correct |
7 |
Correct |
496 ms |
864 KB |
Output is correct |
8 |
Correct |
3 ms |
864 KB |
Output is correct |
9 |
Correct |
5 ms |
776 KB |
Output is correct |
10 |
Correct |
2 ms |
992 KB |
Output is correct |
11 |
Correct |
674 ms |
944 KB |
Output is correct |
12 |
Correct |
534 ms |
936 KB |
Output is correct |
13 |
Correct |
542 ms |
992 KB |
Output is correct |
14 |
Correct |
510 ms |
892 KB |
Output is correct |
15 |
Correct |
56 ms |
936 KB |
Output is correct |
16 |
Correct |
71 ms |
992 KB |
Output is correct |
17 |
Correct |
114 ms |
980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
988 ms |
892 KB |
Output is correct |
2 |
Correct |
719 ms |
1236 KB |
Output is correct |
3 |
Correct |
632 ms |
944 KB |
Output is correct |
4 |
Correct |
3 ms |
864 KB |
Output is correct |
5 |
Correct |
5 ms |
864 KB |
Output is correct |
6 |
Correct |
2 ms |
944 KB |
Output is correct |
7 |
Correct |
563 ms |
736 KB |
Output is correct |
8 |
Correct |
907 ms |
864 KB |
Output is correct |
9 |
Correct |
743 ms |
952 KB |
Output is correct |
10 |
Correct |
600 ms |
896 KB |
Output is correct |
11 |
Correct |
6 ms |
864 KB |
Output is correct |
12 |
Correct |
6 ms |
944 KB |
Output is correct |
13 |
Correct |
5 ms |
736 KB |
Output is correct |
14 |
Correct |
5 ms |
952 KB |
Output is correct |
15 |
Correct |
2 ms |
736 KB |
Output is correct |
16 |
Correct |
523 ms |
992 KB |
Output is correct |
17 |
Correct |
492 ms |
944 KB |
Output is correct |
18 |
Correct |
518 ms |
736 KB |
Output is correct |
19 |
Correct |
492 ms |
944 KB |
Output is correct |
20 |
Correct |
522 ms |
864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
522 ms |
1052 KB |
Partially correct |
2 |
Partially correct |
514 ms |
1052 KB |
Partially correct |
3 |
Correct |
916 ms |
944 KB |
Output is correct |
4 |
Correct |
703 ms |
864 KB |
Output is correct |
5 |
Correct |
812 ms |
864 KB |
Output is correct |
6 |
Partially correct |
565 ms |
1076 KB |
Partially correct |
7 |
Partially correct |
473 ms |
1108 KB |
Partially correct |
8 |
Correct |
3 ms |
944 KB |
Output is correct |
9 |
Correct |
5 ms |
944 KB |
Output is correct |
10 |
Correct |
2 ms |
864 KB |
Output is correct |
11 |
Partially correct |
509 ms |
864 KB |
Partially correct |
12 |
Partially correct |
542 ms |
884 KB |
Partially correct |
13 |
Correct |
953 ms |
1024 KB |
Output is correct |
14 |
Correct |
734 ms |
1012 KB |
Output is correct |
15 |
Correct |
704 ms |
748 KB |
Output is correct |
16 |
Partially correct |
482 ms |
896 KB |
Partially correct |
17 |
Correct |
741 ms |
1120 KB |
Output is correct |
18 |
Partially correct |
516 ms |
992 KB |
Partially correct |
19 |
Partially correct |
495 ms |
1120 KB |
Partially correct |
20 |
Partially correct |
562 ms |
748 KB |
Partially correct |
21 |
Correct |
76 ms |
936 KB |
Output is correct |
22 |
Partially correct |
96 ms |
864 KB |
Partially correct |
23 |
Partially correct |
136 ms |
884 KB |
Partially correct |
24 |
Correct |
6 ms |
864 KB |
Output is correct |
25 |
Correct |
6 ms |
864 KB |
Output is correct |
26 |
Correct |
6 ms |
736 KB |
Output is correct |
27 |
Correct |
4 ms |
864 KB |
Output is correct |
28 |
Correct |
2 ms |
864 KB |
Output is correct |
29 |
Correct |
479 ms |
864 KB |
Output is correct |
30 |
Correct |
490 ms |
944 KB |
Output is correct |
31 |
Correct |
510 ms |
988 KB |
Output is correct |
32 |
Correct |
533 ms |
944 KB |
Output is correct |
33 |
Correct |
495 ms |
736 KB |
Output is correct |
34 |
Partially correct |
389 ms |
1164 KB |
Partially correct |
35 |
Partially correct |
415 ms |
1160 KB |
Partially correct |
36 |
Partially correct |
478 ms |
1084 KB |
Partially correct |
37 |
Partially correct |
556 ms |
1252 KB |
Partially correct |
38 |
Partially correct |
439 ms |
1088 KB |
Partially correct |
39 |
Partially correct |
441 ms |
1008 KB |
Partially correct |
40 |
Partially correct |
517 ms |
976 KB |
Partially correct |
41 |
Partially correct |
548 ms |
1064 KB |
Partially correct |
42 |
Partially correct |
58 ms |
864 KB |
Partially correct |
43 |
Partially correct |
97 ms |
1016 KB |
Partially correct |
44 |
Partially correct |
200 ms |
1112 KB |
Partially correct |
45 |
Partially correct |
161 ms |
1108 KB |
Partially correct |
46 |
Partially correct |
290 ms |
864 KB |
Partially correct |
47 |
Partially correct |
371 ms |
972 KB |
Partially correct |
48 |
Partially correct |
54 ms |
992 KB |
Partially correct |
49 |
Partially correct |
63 ms |
992 KB |
Partially correct |