답안 #607052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
607052 2022-07-26T11:30:16 Z loctildore 게임 (APIO22_game) C++17
60 / 100
128 ms 6016 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[30069],revs[30069];
int lft[30069],rht[30069];
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 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 2 ms 1700 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 2 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1728 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 2 ms 1700 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 2 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1728 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 2 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 3 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 4 ms 1856 KB Output is correct
25 Correct 3 ms 1744 KB Output is correct
26 Correct 4 ms 1820 KB Output is correct
27 Correct 2 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 3 ms 1796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 2 ms 1700 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 2 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1728 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 2 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 3 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 4 ms 1856 KB Output is correct
25 Correct 3 ms 1744 KB Output is correct
26 Correct 4 ms 1820 KB Output is correct
27 Correct 2 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 3 ms 1796 KB Output is correct
30 Correct 20 ms 3052 KB Output is correct
31 Correct 6 ms 2384 KB Output is correct
32 Correct 27 ms 4420 KB Output is correct
33 Correct 24 ms 3816 KB Output is correct
34 Correct 69 ms 6008 KB Output is correct
35 Correct 49 ms 4604 KB Output is correct
36 Correct 31 ms 3764 KB Output is correct
37 Correct 28 ms 3648 KB Output is correct
38 Correct 24 ms 3484 KB Output is correct
39 Correct 31 ms 3572 KB Output is correct
40 Correct 85 ms 6016 KB Output is correct
41 Correct 34 ms 4128 KB Output is correct
42 Correct 30 ms 3916 KB Output is correct
43 Correct 33 ms 5196 KB Output is correct
44 Correct 128 ms 5664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1616 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 2 ms 1700 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 2 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1728 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 2 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 3 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 4 ms 1856 KB Output is correct
25 Correct 3 ms 1744 KB Output is correct
26 Correct 4 ms 1820 KB Output is correct
27 Correct 2 ms 1744 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 3 ms 1796 KB Output is correct
30 Correct 20 ms 3052 KB Output is correct
31 Correct 6 ms 2384 KB Output is correct
32 Correct 27 ms 4420 KB Output is correct
33 Correct 24 ms 3816 KB Output is correct
34 Correct 69 ms 6008 KB Output is correct
35 Correct 49 ms 4604 KB Output is correct
36 Correct 31 ms 3764 KB Output is correct
37 Correct 28 ms 3648 KB Output is correct
38 Correct 24 ms 3484 KB Output is correct
39 Correct 31 ms 3572 KB Output is correct
40 Correct 85 ms 6016 KB Output is correct
41 Correct 34 ms 4128 KB Output is correct
42 Correct 30 ms 3916 KB Output is correct
43 Correct 33 ms 5196 KB Output is correct
44 Correct 128 ms 5664 KB Output is correct
45 Runtime error 3 ms 3608 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -