답안 #607053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
607053 2022-07-26T11:31:25 Z loctildore 게임 (APIO22_game) C++17
60 / 100
4000 ms 45512 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 547
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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 14288 KB Output is correct
2 Correct 7 ms 14280 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 7 ms 14288 KB Output is correct
7 Correct 8 ms 14392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 14288 KB Output is correct
2 Correct 7 ms 14280 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 7 ms 14288 KB Output is correct
7 Correct 8 ms 14392 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 8 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 8 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 14288 KB Output is correct
2 Correct 7 ms 14280 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 7 ms 14288 KB Output is correct
7 Correct 8 ms 14392 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 8 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 8 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14392 KB Output is correct
20 Correct 8 ms 14424 KB Output is correct
21 Correct 9 ms 14416 KB Output is correct
22 Correct 8 ms 14416 KB Output is correct
23 Correct 8 ms 14416 KB Output is correct
24 Correct 10 ms 14616 KB Output is correct
25 Correct 10 ms 14416 KB Output is correct
26 Correct 11 ms 14416 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 9 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 14288 KB Output is correct
2 Correct 7 ms 14280 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 7 ms 14288 KB Output is correct
7 Correct 8 ms 14392 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 8 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 8 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14392 KB Output is correct
20 Correct 8 ms 14424 KB Output is correct
21 Correct 9 ms 14416 KB Output is correct
22 Correct 8 ms 14416 KB Output is correct
23 Correct 8 ms 14416 KB Output is correct
24 Correct 10 ms 14616 KB Output is correct
25 Correct 10 ms 14416 KB Output is correct
26 Correct 11 ms 14416 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 9 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
30 Correct 27 ms 15676 KB Output is correct
31 Correct 11 ms 14928 KB Output is correct
32 Correct 28 ms 17080 KB Output is correct
33 Correct 26 ms 16392 KB Output is correct
34 Correct 64 ms 18676 KB Output is correct
35 Correct 51 ms 17256 KB Output is correct
36 Correct 39 ms 16504 KB Output is correct
37 Correct 38 ms 16392 KB Output is correct
38 Correct 41 ms 16152 KB Output is correct
39 Correct 44 ms 16288 KB Output is correct
40 Correct 87 ms 18804 KB Output is correct
41 Correct 47 ms 16876 KB Output is correct
42 Correct 45 ms 16560 KB Output is correct
43 Correct 39 ms 17856 KB Output is correct
44 Correct 147 ms 18356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 14288 KB Output is correct
2 Correct 7 ms 14280 KB Output is correct
3 Correct 7 ms 14288 KB Output is correct
4 Correct 9 ms 14288 KB Output is correct
5 Correct 8 ms 14288 KB Output is correct
6 Correct 7 ms 14288 KB Output is correct
7 Correct 8 ms 14392 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 8 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 8 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 10 ms 14288 KB Output is correct
18 Correct 8 ms 14288 KB Output is correct
19 Correct 9 ms 14392 KB Output is correct
20 Correct 8 ms 14424 KB Output is correct
21 Correct 9 ms 14416 KB Output is correct
22 Correct 8 ms 14416 KB Output is correct
23 Correct 8 ms 14416 KB Output is correct
24 Correct 10 ms 14616 KB Output is correct
25 Correct 10 ms 14416 KB Output is correct
26 Correct 11 ms 14416 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 9 ms 14416 KB Output is correct
29 Correct 9 ms 14416 KB Output is correct
30 Correct 27 ms 15676 KB Output is correct
31 Correct 11 ms 14928 KB Output is correct
32 Correct 28 ms 17080 KB Output is correct
33 Correct 26 ms 16392 KB Output is correct
34 Correct 64 ms 18676 KB Output is correct
35 Correct 51 ms 17256 KB Output is correct
36 Correct 39 ms 16504 KB Output is correct
37 Correct 38 ms 16392 KB Output is correct
38 Correct 41 ms 16152 KB Output is correct
39 Correct 44 ms 16288 KB Output is correct
40 Correct 87 ms 18804 KB Output is correct
41 Correct 47 ms 16876 KB Output is correct
42 Correct 45 ms 16560 KB Output is correct
43 Correct 39 ms 17856 KB Output is correct
44 Correct 147 ms 18356 KB Output is correct
45 Correct 280 ms 28028 KB Output is correct
46 Correct 20 ms 17104 KB Output is correct
47 Correct 12 ms 17104 KB Output is correct
48 Correct 503 ms 45512 KB Output is correct
49 Correct 304 ms 35492 KB Output is correct
50 Execution timed out 4042 ms 40644 KB Time limit exceeded
51 Halted 0 ms 0 KB -