# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
72036 |
2018-08-26T04:52:11 Z |
The quick brown fox jumps over the lazy dog(#2200, khsoo01) |
Key of Impassable Doors (FXCUP3_key) |
C++17 |
|
115 ms |
5164 KB |
#include "key.h"
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef pair<int,int> pii;
const int N = 1005;
int n, par[N], cyc[N], cs[N], cc;
pii ord[N];
bool vis[N];
vector<int> ci[N];
int dfs (int I) {
if(vis[I]) return 0;
if(cyc[I]) {
for(auto &T : ci[cyc[I]]) {
vis[T] = true;
}
return cs[cyc[I]];
}
else {
vis[I] = true;
return dfs(par[I]) + 1;
}
}
int Try (vector<int> &V) {
fill(vis+1, vis+1+n, false);
int R = 0;
for(auto &T : V) {
R += dfs(T);
}
return R;
}
void EnsureKeyInfo(int _N) {
n = _N;
for(int i=1;i<=n;i++) {
TakeKey(i);
int T = Explore();
ord[i] = {T, i};
}
sort(ord+1, ord+1+n);
for(int i=1;i<=n;i++) {
if(ord[i].X == 1) {
cyc[ord[i].Y] = ++cc;
cs[cc] = 1;
ci[cc].push_back(ord[i].Y);
continue;
}
int S = 1, E = i;
bool inc = false;
while(S<E) {
int M = (S+E)/2;
vector<int> V;
for(int j=1;j<=M;j++) {
V.push_back(ord[j].Y);
TakeKey(ord[j].Y);
}
TakeKey(ord[i].Y);
int A = Try(V), B = Explore();
if(B - A == 0) inc = true;
if(B - A <= 1) E = M;
else S = M+1;
}
if(S == i) {
cyc[ord[i].Y] = ++cc;
cs[cc] = ord[i].X;
ci[cc].push_back(ord[i].Y);
continue;
}
else if(inc) {
cyc[ord[i].Y] = cyc[ord[S].Y];
ci[cyc[ord[S].Y]].push_back(ord[i].Y);
}
else par[ord[i].Y] = ord[S].Y;
}
for(int i=1;i<=n;i++) {
fill(vis+1, vis+1+n, false);
dfs(i);
for(int j=1;j<=n;j++) {
if(vis[j]) Report(i, j);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
612 KB |
Output is correct |
3 |
Correct |
4 ms |
648 KB |
Output is correct |
4 |
Correct |
3 ms |
652 KB |
Output is correct |
5 |
Correct |
3 ms |
656 KB |
Output is correct |
6 |
Correct |
4 ms |
788 KB |
Output is correct |
7 |
Correct |
6 ms |
836 KB |
Output is correct |
8 |
Correct |
4 ms |
904 KB |
Output is correct |
9 |
Correct |
5 ms |
904 KB |
Output is correct |
10 |
Correct |
4 ms |
1040 KB |
Output is correct |
11 |
Correct |
3 ms |
1040 KB |
Output is correct |
12 |
Correct |
4 ms |
1040 KB |
Output is correct |
13 |
Correct |
4 ms |
1104 KB |
Output is correct |
14 |
Correct |
4 ms |
1104 KB |
Output is correct |
15 |
Correct |
4 ms |
1148 KB |
Output is correct |
16 |
Correct |
4 ms |
1156 KB |
Output is correct |
17 |
Correct |
4 ms |
1156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
612 KB |
Output is correct |
3 |
Correct |
4 ms |
648 KB |
Output is correct |
4 |
Correct |
3 ms |
652 KB |
Output is correct |
5 |
Correct |
3 ms |
656 KB |
Output is correct |
6 |
Correct |
4 ms |
788 KB |
Output is correct |
7 |
Correct |
6 ms |
836 KB |
Output is correct |
8 |
Correct |
4 ms |
904 KB |
Output is correct |
9 |
Correct |
5 ms |
904 KB |
Output is correct |
10 |
Correct |
4 ms |
1040 KB |
Output is correct |
11 |
Correct |
3 ms |
1040 KB |
Output is correct |
12 |
Correct |
4 ms |
1040 KB |
Output is correct |
13 |
Correct |
4 ms |
1104 KB |
Output is correct |
14 |
Correct |
4 ms |
1104 KB |
Output is correct |
15 |
Correct |
4 ms |
1148 KB |
Output is correct |
16 |
Correct |
4 ms |
1156 KB |
Output is correct |
17 |
Correct |
4 ms |
1156 KB |
Output is correct |
18 |
Correct |
16 ms |
2056 KB |
Output is correct |
19 |
Correct |
11 ms |
2076 KB |
Output is correct |
20 |
Correct |
15 ms |
2076 KB |
Output is correct |
21 |
Correct |
7 ms |
2076 KB |
Output is correct |
22 |
Correct |
12 ms |
2076 KB |
Output is correct |
23 |
Correct |
29 ms |
2716 KB |
Output is correct |
24 |
Correct |
25 ms |
2736 KB |
Output is correct |
25 |
Correct |
19 ms |
2736 KB |
Output is correct |
26 |
Correct |
18 ms |
2856 KB |
Output is correct |
27 |
Correct |
20 ms |
2856 KB |
Output is correct |
28 |
Correct |
20 ms |
2856 KB |
Output is correct |
29 |
Correct |
13 ms |
2856 KB |
Output is correct |
30 |
Correct |
30 ms |
2856 KB |
Output is correct |
31 |
Correct |
24 ms |
2856 KB |
Output is correct |
32 |
Correct |
29 ms |
2856 KB |
Output is correct |
33 |
Correct |
28 ms |
2856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
612 KB |
Output is correct |
3 |
Correct |
4 ms |
648 KB |
Output is correct |
4 |
Correct |
3 ms |
652 KB |
Output is correct |
5 |
Correct |
3 ms |
656 KB |
Output is correct |
6 |
Correct |
4 ms |
788 KB |
Output is correct |
7 |
Correct |
6 ms |
836 KB |
Output is correct |
8 |
Correct |
4 ms |
904 KB |
Output is correct |
9 |
Correct |
5 ms |
904 KB |
Output is correct |
10 |
Correct |
4 ms |
1040 KB |
Output is correct |
11 |
Correct |
3 ms |
1040 KB |
Output is correct |
12 |
Correct |
4 ms |
1040 KB |
Output is correct |
13 |
Correct |
4 ms |
1104 KB |
Output is correct |
14 |
Correct |
4 ms |
1104 KB |
Output is correct |
15 |
Correct |
4 ms |
1148 KB |
Output is correct |
16 |
Correct |
4 ms |
1156 KB |
Output is correct |
17 |
Correct |
4 ms |
1156 KB |
Output is correct |
18 |
Correct |
16 ms |
2056 KB |
Output is correct |
19 |
Correct |
11 ms |
2076 KB |
Output is correct |
20 |
Correct |
15 ms |
2076 KB |
Output is correct |
21 |
Correct |
7 ms |
2076 KB |
Output is correct |
22 |
Correct |
12 ms |
2076 KB |
Output is correct |
23 |
Correct |
29 ms |
2716 KB |
Output is correct |
24 |
Correct |
25 ms |
2736 KB |
Output is correct |
25 |
Correct |
19 ms |
2736 KB |
Output is correct |
26 |
Correct |
18 ms |
2856 KB |
Output is correct |
27 |
Correct |
20 ms |
2856 KB |
Output is correct |
28 |
Correct |
20 ms |
2856 KB |
Output is correct |
29 |
Correct |
13 ms |
2856 KB |
Output is correct |
30 |
Correct |
30 ms |
2856 KB |
Output is correct |
31 |
Correct |
24 ms |
2856 KB |
Output is correct |
32 |
Correct |
29 ms |
2856 KB |
Output is correct |
33 |
Correct |
28 ms |
2856 KB |
Output is correct |
34 |
Correct |
78 ms |
4328 KB |
Output is correct |
35 |
Correct |
55 ms |
4452 KB |
Output is correct |
36 |
Correct |
51 ms |
4476 KB |
Output is correct |
37 |
Correct |
33 ms |
4476 KB |
Output is correct |
38 |
Correct |
88 ms |
4508 KB |
Output is correct |
39 |
Correct |
100 ms |
4916 KB |
Output is correct |
40 |
Correct |
100 ms |
5000 KB |
Output is correct |
41 |
Correct |
72 ms |
5000 KB |
Output is correct |
42 |
Correct |
58 ms |
5000 KB |
Output is correct |
43 |
Correct |
74 ms |
5000 KB |
Output is correct |
44 |
Correct |
70 ms |
5032 KB |
Output is correct |
45 |
Correct |
41 ms |
5108 KB |
Output is correct |
46 |
Correct |
102 ms |
5132 KB |
Output is correct |
47 |
Correct |
90 ms |
5132 KB |
Output is correct |
48 |
Correct |
115 ms |
5164 KB |
Output is correct |
49 |
Correct |
115 ms |
5164 KB |
Output is correct |