Submission #607069

# Submission time Handle Problem Language Result Execution time Memory
607069 2022-07-26T11:38:46 Z loctildore Game (APIO22_game) C++17
60 / 100
4000 ms 45452 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
// trans rights
#define ll long long
#define f first
#define s second
#define endl '\n'
#define all(x) begin(x), end(x)
#define bkt 269
int n,k;
bool flag;
vector<int> grph[300069],revs[300069];
int lft[300069],rht[300069];
void init(int N, int K) {
  n=N;
  k=K;
  for (int i = 0; i < k; i++) {
    lft[i]=i/bkt;
    rht[i]=i;
  }
  for (int i = k; i < n; i++) {
    lft[i]=-1;
    rht[i]=k;
  }
}
void dfs(int x) {
  for (int i : grph[x]) {
    if (i<k&&i/bkt<lft[x]) {
      flag=true;
    }
    if (lft[i]<lft[x]) {
      lft[i]=lft[x];
      dfs(i);
    }
    if (x<k&&x>=rht[i]) {
      flag=true;
    }
    if (rht[x]>rht[i]&&rht[i]/bkt==lft[x]) {
      rht[x]=rht[i];
    }
  }
}
void rdfs(int x) {
  for (int i : revs[x]) {
    if (i<k&&i>=rht[x]) {
      flag=true;
    }
    if (rht[i]>rht[x]&&rht[x]/bkt==lft[i]) {
      rht[i]=rht[x];
      rdfs(i);
    }
  }
}
int add_teleporter(int u, int v) {
  grph[u].push_back(v);
  revs[v].push_back(u);
  dfs(u);
  rdfs(u);
  /*for (int i = 0; i < n; i++) {
    cout<<lft[i]<<' '<<rht[i]<<endl;
  }
  cout<<endl;*/
  return flag;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14292 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14292 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14304 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 10 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14336 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14404 KB Output is correct
17 Correct 7 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14292 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14304 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 10 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14336 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14404 KB Output is correct
17 Correct 7 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
20 Correct 9 ms 14416 KB Output is correct
21 Correct 7 ms 14416 KB Output is correct
22 Correct 8 ms 14408 KB Output is correct
23 Correct 8 ms 14416 KB Output is correct
24 Correct 9 ms 14416 KB Output is correct
25 Correct 10 ms 14432 KB Output is correct
26 Correct 13 ms 14432 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 8 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14292 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14304 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 10 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14336 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14404 KB Output is correct
17 Correct 7 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
20 Correct 9 ms 14416 KB Output is correct
21 Correct 7 ms 14416 KB Output is correct
22 Correct 8 ms 14408 KB Output is correct
23 Correct 8 ms 14416 KB Output is correct
24 Correct 9 ms 14416 KB Output is correct
25 Correct 10 ms 14432 KB Output is correct
26 Correct 13 ms 14432 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 8 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
30 Correct 25 ms 15696 KB Output is correct
31 Correct 15 ms 14956 KB Output is correct
32 Correct 37 ms 17128 KB Output is correct
33 Correct 28 ms 16456 KB Output is correct
34 Correct 59 ms 18668 KB Output is correct
35 Correct 48 ms 17252 KB Output is correct
36 Correct 40 ms 16584 KB Output is correct
37 Correct 33 ms 16456 KB Output is correct
38 Correct 33 ms 16192 KB Output is correct
39 Correct 51 ms 16180 KB Output is correct
40 Correct 80 ms 18680 KB Output is correct
41 Correct 45 ms 16832 KB Output is correct
42 Correct 38 ms 16584 KB Output is correct
43 Correct 40 ms 18460 KB Output is correct
44 Correct 88 ms 18352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14292 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14304 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 10 ms 14288 KB Output is correct
12 Correct 8 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14336 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14404 KB Output is correct
17 Correct 7 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
20 Correct 9 ms 14416 KB Output is correct
21 Correct 7 ms 14416 KB Output is correct
22 Correct 8 ms 14408 KB Output is correct
23 Correct 8 ms 14416 KB Output is correct
24 Correct 9 ms 14416 KB Output is correct
25 Correct 10 ms 14432 KB Output is correct
26 Correct 13 ms 14432 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 8 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
30 Correct 25 ms 15696 KB Output is correct
31 Correct 15 ms 14956 KB Output is correct
32 Correct 37 ms 17128 KB Output is correct
33 Correct 28 ms 16456 KB Output is correct
34 Correct 59 ms 18668 KB Output is correct
35 Correct 48 ms 17252 KB Output is correct
36 Correct 40 ms 16584 KB Output is correct
37 Correct 33 ms 16456 KB Output is correct
38 Correct 33 ms 16192 KB Output is correct
39 Correct 51 ms 16180 KB Output is correct
40 Correct 80 ms 18680 KB Output is correct
41 Correct 45 ms 16832 KB Output is correct
42 Correct 38 ms 16584 KB Output is correct
43 Correct 40 ms 18460 KB Output is correct
44 Correct 88 ms 18352 KB Output is correct
45 Correct 288 ms 28064 KB Output is correct
46 Correct 13 ms 17152 KB Output is correct
47 Correct 13 ms 17004 KB Output is correct
48 Correct 423 ms 45452 KB Output is correct
49 Correct 378 ms 35568 KB Output is correct
50 Execution timed out 4075 ms 39888 KB Time limit exceeded
51 Halted 0 ms 0 KB -