Submission #607074

# Submission time Handle Problem Language Result Execution time Memory
607074 2022-07-26T11:44:43 Z loctildore Game (APIO22_game) C++17
60 / 100
4000 ms 45508 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 4069
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 7 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14404 KB Output is correct
8 Correct 10 ms 14312 KB Output is correct
9 Correct 10 ms 14392 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 11 ms 14336 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 10 ms 14300 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 9 ms 14288 KB Output is correct
19 Correct 10 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14404 KB Output is correct
8 Correct 10 ms 14312 KB Output is correct
9 Correct 10 ms 14392 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 11 ms 14336 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 10 ms 14300 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 9 ms 14288 KB Output is correct
19 Correct 10 ms 14288 KB Output is correct
20 Correct 9 ms 14420 KB Output is correct
21 Correct 8 ms 14352 KB Output is correct
22 Correct 9 ms 14416 KB Output is correct
23 Correct 10 ms 14388 KB Output is correct
24 Correct 10 ms 14416 KB Output is correct
25 Correct 13 ms 14436 KB Output is correct
26 Correct 12 ms 14424 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 10 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 7 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14404 KB Output is correct
8 Correct 10 ms 14312 KB Output is correct
9 Correct 10 ms 14392 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 11 ms 14336 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 10 ms 14300 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 9 ms 14288 KB Output is correct
19 Correct 10 ms 14288 KB Output is correct
20 Correct 9 ms 14420 KB Output is correct
21 Correct 8 ms 14352 KB Output is correct
22 Correct 9 ms 14416 KB Output is correct
23 Correct 10 ms 14388 KB Output is correct
24 Correct 10 ms 14416 KB Output is correct
25 Correct 13 ms 14436 KB Output is correct
26 Correct 12 ms 14424 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
30 Correct 30 ms 15788 KB Output is correct
31 Correct 14 ms 14932 KB Output is correct
32 Correct 34 ms 17160 KB Output is correct
33 Correct 26 ms 16472 KB Output is correct
34 Correct 611 ms 18624 KB Output is correct
35 Correct 213 ms 17316 KB Output is correct
36 Correct 36 ms 16380 KB Output is correct
37 Correct 33 ms 16420 KB Output is correct
38 Correct 32 ms 16172 KB Output is correct
39 Correct 38 ms 16204 KB Output is correct
40 Correct 461 ms 18736 KB Output is correct
41 Correct 96 ms 16880 KB Output is correct
42 Correct 69 ms 16640 KB Output is correct
43 Correct 43 ms 17896 KB Output is correct
44 Correct 452 ms 18352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 7 ms 14288 KB Output is correct
3 Correct 8 ms 14288 KB Output is correct
4 Correct 9 ms 14416 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14404 KB Output is correct
8 Correct 10 ms 14312 KB Output is correct
9 Correct 10 ms 14392 KB Output is correct
10 Correct 9 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 11 ms 14336 KB Output is correct
13 Correct 10 ms 14288 KB Output is correct
14 Correct 10 ms 14300 KB Output is correct
15 Correct 8 ms 14412 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 9 ms 14288 KB Output is correct
19 Correct 10 ms 14288 KB Output is correct
20 Correct 9 ms 14420 KB Output is correct
21 Correct 8 ms 14352 KB Output is correct
22 Correct 9 ms 14416 KB Output is correct
23 Correct 10 ms 14388 KB Output is correct
24 Correct 10 ms 14416 KB Output is correct
25 Correct 13 ms 14436 KB Output is correct
26 Correct 12 ms 14424 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 10 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
30 Correct 30 ms 15788 KB Output is correct
31 Correct 14 ms 14932 KB Output is correct
32 Correct 34 ms 17160 KB Output is correct
33 Correct 26 ms 16472 KB Output is correct
34 Correct 611 ms 18624 KB Output is correct
35 Correct 213 ms 17316 KB Output is correct
36 Correct 36 ms 16380 KB Output is correct
37 Correct 33 ms 16420 KB Output is correct
38 Correct 32 ms 16172 KB Output is correct
39 Correct 38 ms 16204 KB Output is correct
40 Correct 461 ms 18736 KB Output is correct
41 Correct 96 ms 16880 KB Output is correct
42 Correct 69 ms 16640 KB Output is correct
43 Correct 43 ms 17896 KB Output is correct
44 Correct 452 ms 18352 KB Output is correct
45 Correct 278 ms 27984 KB Output is correct
46 Correct 15 ms 17132 KB Output is correct
47 Correct 14 ms 17084 KB Output is correct
48 Correct 425 ms 45508 KB Output is correct
49 Correct 364 ms 35508 KB Output is correct
50 Execution timed out 4100 ms 41576 KB Time limit exceeded
51 Halted 0 ms 0 KB -