답안 #982825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982825 2024-05-14T19:02:54 Z alo_54 게임 (APIO22_game) C++17
30 / 100
4000 ms 3660 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

struct Nodo
{
  vector <int> ady;
  bool special = false;

};

vector <Nodo> g;
vector <bool> vis;
bool acPos = 0;
int K;

void dfs(int node, int start)
{
  //cout<<"call "<<node<<endl;

  vis[node] = true;
  
  for (auto i : g[node].ady)
  {
    //cout<<"check "<<i<<endl;
    if (!vis[i])
    {
      //cout<<"check "<<i<<endl;
      dfs(i, start);
    }else
    {
      if (i == start)
      {
        acPos = true;
      }
    
    }
  }


}

void init(int n, int k) 
{
  vis.resize(n);
  g.resize(n);

  K = k;
  
  for (int i = 0; i < k; i++)
  {
    g[i].special = true;

    if (i != k-1)
    {
      g[i].ady.push_back(i+1);
    }
    
    
  }
  
}

int add_teleporter(int u, int v) 
{
  fill(vis.begin(), vis.end(), false);
  g[u].ady.push_back(v);

  if (!acPos)
  {

    for (int i = K - 1; i >= 0; i--)
    {
      dfs(i, i);
    }
    
  }
  
  
  return acPos;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 18 ms 344 KB Output is correct
26 Correct 27 ms 600 KB Output is correct
27 Correct 27 ms 600 KB Output is correct
28 Correct 9 ms 344 KB Output is correct
29 Correct 21 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 18 ms 344 KB Output is correct
26 Correct 27 ms 600 KB Output is correct
27 Correct 27 ms 600 KB Output is correct
28 Correct 9 ms 344 KB Output is correct
29 Correct 21 ms 344 KB Output is correct
30 Correct 75 ms 2396 KB Output is correct
31 Correct 40 ms 2008 KB Output is correct
32 Correct 33 ms 3028 KB Output is correct
33 Correct 18 ms 2680 KB Output is correct
34 Correct 997 ms 3660 KB Output is correct
35 Execution timed out 4005 ms 2596 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 504 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 18 ms 344 KB Output is correct
26 Correct 27 ms 600 KB Output is correct
27 Correct 27 ms 600 KB Output is correct
28 Correct 9 ms 344 KB Output is correct
29 Correct 21 ms 344 KB Output is correct
30 Correct 75 ms 2396 KB Output is correct
31 Correct 40 ms 2008 KB Output is correct
32 Correct 33 ms 3028 KB Output is correct
33 Correct 18 ms 2680 KB Output is correct
34 Correct 997 ms 3660 KB Output is correct
35 Execution timed out 4005 ms 2596 KB Time limit exceeded
36 Halted 0 ms 0 KB -