답안 #969694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969694 2024-04-25T13:15:15 Z anton 게임 (APIO22_game) C++17
60 / 100
504 ms 5720 KB
#include "game.h"
#include<bits/stdc++.h>

using namespace std;
#define pii pair<int, int>

const int MAX_N = 3 * 1e4;

vector<int> adj[MAX_N];
vector<int> rev_adj[MAX_N];
int min_acc[MAX_N];
int N, K;

bool broken = false;
void rev_dfs(int u, int acc){
  //cout<<u<<" "<<acc<<endl;
  min_acc[u] = acc;
  if(u<K && acc<=u){
    broken = true;
  }
  for(auto e: rev_adj[u]){
    if(min_acc[e]>acc){
      rev_dfs(e, acc);
    }
  }
}

void init(int n, int k) {
  N= n, K = k;
  for(int i = 0; i<N; i++){
    min_acc[i] = K;
  }
  for(int i = 0; i<k-1; i++){
    adj[i].push_back(i+1);
    rev_adj[i+1].push_back(i);
  }
}

int add_teleporter(int u, int v) {
  adj[u].push_back(v);
  rev_adj[v].push_back(u);

  if(min_acc[v]<min_acc[u]){
    rev_dfs(u, min(v, min_acc[v]));
  }
  else if(v<min_acc[u]){
    rev_dfs(u, v);
  }
  if(broken){
    return 1;
  }
  //cout<<endl;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1624 KB Output is correct
3 Correct 1 ms 1624 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1624 KB Output is correct
7 Correct 1 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1624 KB Output is correct
3 Correct 1 ms 1624 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1624 KB Output is correct
7 Correct 1 ms 1624 KB Output is correct
8 Correct 1 ms 1624 KB Output is correct
9 Correct 1 ms 1624 KB Output is correct
10 Correct 1 ms 1624 KB Output is correct
11 Correct 1 ms 1624 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1624 KB Output is correct
14 Correct 1 ms 1624 KB Output is correct
15 Correct 1 ms 1624 KB Output is correct
16 Correct 1 ms 1880 KB Output is correct
17 Correct 2 ms 1624 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1624 KB Output is correct
3 Correct 1 ms 1624 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1624 KB Output is correct
7 Correct 1 ms 1624 KB Output is correct
8 Correct 1 ms 1624 KB Output is correct
9 Correct 1 ms 1624 KB Output is correct
10 Correct 1 ms 1624 KB Output is correct
11 Correct 1 ms 1624 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1624 KB Output is correct
14 Correct 1 ms 1624 KB Output is correct
15 Correct 1 ms 1624 KB Output is correct
16 Correct 1 ms 1880 KB Output is correct
17 Correct 2 ms 1624 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
20 Correct 1 ms 1880 KB Output is correct
21 Correct 2 ms 1620 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 1 ms 1880 KB Output is correct
24 Correct 2 ms 2136 KB Output is correct
25 Correct 3 ms 2136 KB Output is correct
26 Correct 3 ms 2136 KB Output is correct
27 Correct 3 ms 2136 KB Output is correct
28 Correct 2 ms 1880 KB Output is correct
29 Correct 2 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1624 KB Output is correct
3 Correct 1 ms 1624 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1624 KB Output is correct
7 Correct 1 ms 1624 KB Output is correct
8 Correct 1 ms 1624 KB Output is correct
9 Correct 1 ms 1624 KB Output is correct
10 Correct 1 ms 1624 KB Output is correct
11 Correct 1 ms 1624 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1624 KB Output is correct
14 Correct 1 ms 1624 KB Output is correct
15 Correct 1 ms 1624 KB Output is correct
16 Correct 1 ms 1880 KB Output is correct
17 Correct 2 ms 1624 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
20 Correct 1 ms 1880 KB Output is correct
21 Correct 2 ms 1620 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 1 ms 1880 KB Output is correct
24 Correct 2 ms 2136 KB Output is correct
25 Correct 3 ms 2136 KB Output is correct
26 Correct 3 ms 2136 KB Output is correct
27 Correct 3 ms 2136 KB Output is correct
28 Correct 2 ms 1880 KB Output is correct
29 Correct 2 ms 1880 KB Output is correct
30 Correct 16 ms 3560 KB Output is correct
31 Correct 4 ms 2648 KB Output is correct
32 Correct 16 ms 4740 KB Output is correct
33 Correct 16 ms 4236 KB Output is correct
34 Correct 504 ms 5720 KB Output is correct
35 Correct 172 ms 4556 KB Output is correct
36 Correct 30 ms 4532 KB Output is correct
37 Correct 20 ms 4176 KB Output is correct
38 Correct 20 ms 4696 KB Output is correct
39 Correct 25 ms 4148 KB Output is correct
40 Correct 382 ms 5352 KB Output is correct
41 Correct 84 ms 4184 KB Output is correct
42 Correct 56 ms 4532 KB Output is correct
43 Correct 28 ms 5196 KB Output is correct
44 Correct 394 ms 5640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1624 KB Output is correct
3 Correct 1 ms 1624 KB Output is correct
4 Correct 1 ms 1624 KB Output is correct
5 Correct 1 ms 1624 KB Output is correct
6 Correct 1 ms 1624 KB Output is correct
7 Correct 1 ms 1624 KB Output is correct
8 Correct 1 ms 1624 KB Output is correct
9 Correct 1 ms 1624 KB Output is correct
10 Correct 1 ms 1624 KB Output is correct
11 Correct 1 ms 1624 KB Output is correct
12 Correct 1 ms 1624 KB Output is correct
13 Correct 1 ms 1624 KB Output is correct
14 Correct 1 ms 1624 KB Output is correct
15 Correct 1 ms 1624 KB Output is correct
16 Correct 1 ms 1880 KB Output is correct
17 Correct 2 ms 1624 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
20 Correct 1 ms 1880 KB Output is correct
21 Correct 2 ms 1620 KB Output is correct
22 Correct 2 ms 1880 KB Output is correct
23 Correct 1 ms 1880 KB Output is correct
24 Correct 2 ms 2136 KB Output is correct
25 Correct 3 ms 2136 KB Output is correct
26 Correct 3 ms 2136 KB Output is correct
27 Correct 3 ms 2136 KB Output is correct
28 Correct 2 ms 1880 KB Output is correct
29 Correct 2 ms 1880 KB Output is correct
30 Correct 16 ms 3560 KB Output is correct
31 Correct 4 ms 2648 KB Output is correct
32 Correct 16 ms 4740 KB Output is correct
33 Correct 16 ms 4236 KB Output is correct
34 Correct 504 ms 5720 KB Output is correct
35 Correct 172 ms 4556 KB Output is correct
36 Correct 30 ms 4532 KB Output is correct
37 Correct 20 ms 4176 KB Output is correct
38 Correct 20 ms 4696 KB Output is correct
39 Correct 25 ms 4148 KB Output is correct
40 Correct 382 ms 5352 KB Output is correct
41 Correct 84 ms 4184 KB Output is correct
42 Correct 56 ms 4532 KB Output is correct
43 Correct 28 ms 5196 KB Output is correct
44 Correct 394 ms 5640 KB Output is correct
45 Runtime error 2 ms 3672 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -