답안 #740998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
740998 2023-05-13T11:20:15 Z LittleCube 게임 (APIO22_game) C++17
60 / 100
4000 ms 39688 KB
#pragma GCC optimize("Ofast,unroll-loops")
#include "game.h"
#ifndef EVAL
#include "game_grader.cpp"
#endif
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;

namespace
{
  int n, k, from[300000], to[300000];
  vector<int> Ef[300000], Et[300000];
  void update_from(int u)
  {
    for (auto v : Ef[u])
      if (from[u] > from[v])
      {
        from[v] = from[u];
        update_from(v);
      }
  }
  void update_to(int u)
  {
    for (auto v : Et[u])
      if (to[u] < to[v])
      {
        to[v] = to[u];
        update_to(v);
      }
  }
}

void init(int n, int k)
{
  ::n = n, ::k = k;
  for (int i = 0; i < k; i++)
    from[i] = i, to[i] = i;
  for (int i = k; i < n; i++)
    from[i] = -1, to[i] = k + 1;
}

int add_teleporter(int u, int v)
{
  if (u < k && v < k)
  {
    if (v <= u)
      return 1;
    return 0;
  }
  Ef[u].emplace_back(v);
  Et[v].emplace_back(u);
  from[v] = max(from[v], from[u]);
  to[u] = min(to[u], to[v]);
  bool flag = 0;
  if (v >= k)
  {
    update_from(v);
    flag |= (from[v] >= to[v]);
  }
  if (u >= k)
  {
    update_to(u);
    flag |= (from[u] >= to[u]);
  }
  return flag;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 9 ms 14328 KB Output is correct
4 Correct 10 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 9 ms 14328 KB Output is correct
4 Correct 10 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 10 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14316 KB Output is correct
14 Correct 8 ms 14416 KB Output is correct
15 Correct 9 ms 14416 KB Output is correct
16 Correct 9 ms 14336 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14360 KB Output is correct
19 Correct 9 ms 14408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 9 ms 14328 KB Output is correct
4 Correct 10 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 10 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14316 KB Output is correct
14 Correct 8 ms 14416 KB Output is correct
15 Correct 9 ms 14416 KB Output is correct
16 Correct 9 ms 14336 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14360 KB Output is correct
19 Correct 9 ms 14408 KB Output is correct
20 Correct 10 ms 14412 KB Output is correct
21 Correct 8 ms 14416 KB Output is correct
22 Correct 10 ms 14404 KB Output is correct
23 Correct 9 ms 14416 KB Output is correct
24 Correct 12 ms 14472 KB Output is correct
25 Correct 11 ms 14420 KB Output is correct
26 Correct 10 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 10 ms 14412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 9 ms 14328 KB Output is correct
4 Correct 10 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 10 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14316 KB Output is correct
14 Correct 8 ms 14416 KB Output is correct
15 Correct 9 ms 14416 KB Output is correct
16 Correct 9 ms 14336 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14360 KB Output is correct
19 Correct 9 ms 14408 KB Output is correct
20 Correct 10 ms 14412 KB Output is correct
21 Correct 8 ms 14416 KB Output is correct
22 Correct 10 ms 14404 KB Output is correct
23 Correct 9 ms 14416 KB Output is correct
24 Correct 12 ms 14472 KB Output is correct
25 Correct 11 ms 14420 KB Output is correct
26 Correct 10 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 10 ms 14412 KB Output is correct
30 Correct 23 ms 15744 KB Output is correct
31 Correct 14 ms 14928 KB Output is correct
32 Correct 29 ms 16888 KB Output is correct
33 Correct 32 ms 16416 KB Output is correct
34 Correct 1024 ms 17372 KB Output is correct
35 Correct 380 ms 16776 KB Output is correct
36 Correct 59 ms 16412 KB Output is correct
37 Correct 50 ms 16480 KB Output is correct
38 Correct 32 ms 16200 KB Output is correct
39 Correct 34 ms 16180 KB Output is correct
40 Correct 833 ms 17448 KB Output is correct
41 Correct 157 ms 16468 KB Output is correct
42 Correct 117 ms 16368 KB Output is correct
43 Correct 72 ms 17456 KB Output is correct
44 Correct 696 ms 17284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14288 KB Output is correct
3 Correct 9 ms 14328 KB Output is correct
4 Correct 10 ms 14288 KB Output is correct
5 Correct 9 ms 14288 KB Output is correct
6 Correct 9 ms 14288 KB Output is correct
7 Correct 8 ms 14288 KB Output is correct
8 Correct 8 ms 14288 KB Output is correct
9 Correct 9 ms 14288 KB Output is correct
10 Correct 10 ms 14288 KB Output is correct
11 Correct 9 ms 14288 KB Output is correct
12 Correct 9 ms 14288 KB Output is correct
13 Correct 9 ms 14316 KB Output is correct
14 Correct 8 ms 14416 KB Output is correct
15 Correct 9 ms 14416 KB Output is correct
16 Correct 9 ms 14336 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14360 KB Output is correct
19 Correct 9 ms 14408 KB Output is correct
20 Correct 10 ms 14412 KB Output is correct
21 Correct 8 ms 14416 KB Output is correct
22 Correct 10 ms 14404 KB Output is correct
23 Correct 9 ms 14416 KB Output is correct
24 Correct 12 ms 14472 KB Output is correct
25 Correct 11 ms 14420 KB Output is correct
26 Correct 10 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 10 ms 14412 KB Output is correct
30 Correct 23 ms 15744 KB Output is correct
31 Correct 14 ms 14928 KB Output is correct
32 Correct 29 ms 16888 KB Output is correct
33 Correct 32 ms 16416 KB Output is correct
34 Correct 1024 ms 17372 KB Output is correct
35 Correct 380 ms 16776 KB Output is correct
36 Correct 59 ms 16412 KB Output is correct
37 Correct 50 ms 16480 KB Output is correct
38 Correct 32 ms 16200 KB Output is correct
39 Correct 34 ms 16180 KB Output is correct
40 Correct 833 ms 17448 KB Output is correct
41 Correct 157 ms 16468 KB Output is correct
42 Correct 117 ms 16368 KB Output is correct
43 Correct 72 ms 17456 KB Output is correct
44 Correct 696 ms 17284 KB Output is correct
45 Correct 282 ms 28004 KB Output is correct
46 Correct 15 ms 17104 KB Output is correct
47 Correct 15 ms 17036 KB Output is correct
48 Correct 425 ms 39688 KB Output is correct
49 Correct 328 ms 35444 KB Output is correct
50 Execution timed out 4046 ms 30376 KB Time limit exceeded
51 Halted 0 ms 0 KB -