답안 #983881

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983881 2024-05-16T07:42:33 Z vjudge1 게임 (APIO22_game) C++17
30 / 100
4000 ms 10728 KB
#include <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>

#include "game.h"
#define ll long long
using namespace std;
vector<int> g[300005];
bool ok = 0, f = 0;;
bool us[300005], c[300005], dd[300005];
int N, K;
void dfs(int p){
  us[p] = 1;
  dd[p] = 1;
  for(int to : g[p]){
    if(to < K && dd[to] == 1) f = 1;
    if(us[to]) continue;
    dfs(to);
  }
  dd[p] = 0;
}
void init(int n, int k){
  for(int i = 0; i < k - 1; i++)
    g[i].push_back(i + 1);
  N = n;
  K = k;
}
int add_teleporter(int u, int v) {
  if(ok) return 1;
  if(u < K && v < K && u >= v){
    ok = 1;
    return 1;
  }
  if(u < K && v < K) return 0;
  g[u].push_back(v);
  f = 0;
  if(v < K) c[u] = 1;
  for(int i = 0; i <= N; i++) us[i] = 0;
  dfs(0);
  if(f == 1){
    ok = 1;
    return 1;
  }
  return 0;
}
// int a, b, t;
// int main(){
//   cin >> a >> t;

//   cin >> b;
//   init(a, b);
//   while(t--){
//     int x, y;
//     cin >> x >> y;
//     cout << add_teleporter(x, y) << "\n";
//   }
// }

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 5 ms 7956 KB Output is correct
3 Correct 4 ms 8024 KB Output is correct
4 Correct 4 ms 8024 KB Output is correct
5 Correct 4 ms 7256 KB Output is correct
6 Correct 4 ms 7256 KB Output is correct
7 Correct 4 ms 7256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 5 ms 7956 KB Output is correct
3 Correct 4 ms 8024 KB Output is correct
4 Correct 4 ms 8024 KB Output is correct
5 Correct 4 ms 7256 KB Output is correct
6 Correct 4 ms 7256 KB Output is correct
7 Correct 4 ms 7256 KB Output is correct
8 Correct 4 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 3 ms 7256 KB Output is correct
11 Correct 3 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 3 ms 8024 KB Output is correct
15 Correct 3 ms 8024 KB Output is correct
16 Correct 3 ms 7252 KB Output is correct
17 Correct 4 ms 7256 KB Output is correct
18 Correct 2 ms 8024 KB Output is correct
19 Correct 3 ms 8024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 5 ms 7956 KB Output is correct
3 Correct 4 ms 8024 KB Output is correct
4 Correct 4 ms 8024 KB Output is correct
5 Correct 4 ms 7256 KB Output is correct
6 Correct 4 ms 7256 KB Output is correct
7 Correct 4 ms 7256 KB Output is correct
8 Correct 4 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 3 ms 7256 KB Output is correct
11 Correct 3 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 3 ms 8024 KB Output is correct
15 Correct 3 ms 8024 KB Output is correct
16 Correct 3 ms 7252 KB Output is correct
17 Correct 4 ms 7256 KB Output is correct
18 Correct 2 ms 8024 KB Output is correct
19 Correct 3 ms 8024 KB Output is correct
20 Correct 3 ms 8024 KB Output is correct
21 Correct 3 ms 8024 KB Output is correct
22 Correct 3 ms 8020 KB Output is correct
23 Correct 3 ms 8024 KB Output is correct
24 Correct 8 ms 8248 KB Output is correct
25 Correct 28 ms 8280 KB Output is correct
26 Correct 34 ms 8024 KB Output is correct
27 Correct 37 ms 8280 KB Output is correct
28 Correct 14 ms 8024 KB Output is correct
29 Correct 21 ms 8280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 5 ms 7956 KB Output is correct
3 Correct 4 ms 8024 KB Output is correct
4 Correct 4 ms 8024 KB Output is correct
5 Correct 4 ms 7256 KB Output is correct
6 Correct 4 ms 7256 KB Output is correct
7 Correct 4 ms 7256 KB Output is correct
8 Correct 4 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 3 ms 7256 KB Output is correct
11 Correct 3 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 3 ms 8024 KB Output is correct
15 Correct 3 ms 8024 KB Output is correct
16 Correct 3 ms 7252 KB Output is correct
17 Correct 4 ms 7256 KB Output is correct
18 Correct 2 ms 8024 KB Output is correct
19 Correct 3 ms 8024 KB Output is correct
20 Correct 3 ms 8024 KB Output is correct
21 Correct 3 ms 8024 KB Output is correct
22 Correct 3 ms 8020 KB Output is correct
23 Correct 3 ms 8024 KB Output is correct
24 Correct 8 ms 8248 KB Output is correct
25 Correct 28 ms 8280 KB Output is correct
26 Correct 34 ms 8024 KB Output is correct
27 Correct 37 ms 8280 KB Output is correct
28 Correct 14 ms 8024 KB Output is correct
29 Correct 21 ms 8280 KB Output is correct
30 Correct 103 ms 8836 KB Output is correct
31 Correct 64 ms 8620 KB Output is correct
32 Correct 60 ms 9688 KB Output is correct
33 Correct 30 ms 9572 KB Output is correct
34 Correct 1078 ms 10728 KB Output is correct
35 Execution timed out 4014 ms 9328 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 5 ms 7956 KB Output is correct
3 Correct 4 ms 8024 KB Output is correct
4 Correct 4 ms 8024 KB Output is correct
5 Correct 4 ms 7256 KB Output is correct
6 Correct 4 ms 7256 KB Output is correct
7 Correct 4 ms 7256 KB Output is correct
8 Correct 4 ms 7256 KB Output is correct
9 Correct 3 ms 7256 KB Output is correct
10 Correct 3 ms 7256 KB Output is correct
11 Correct 3 ms 7256 KB Output is correct
12 Correct 3 ms 7256 KB Output is correct
13 Correct 3 ms 7256 KB Output is correct
14 Correct 3 ms 8024 KB Output is correct
15 Correct 3 ms 8024 KB Output is correct
16 Correct 3 ms 7252 KB Output is correct
17 Correct 4 ms 7256 KB Output is correct
18 Correct 2 ms 8024 KB Output is correct
19 Correct 3 ms 8024 KB Output is correct
20 Correct 3 ms 8024 KB Output is correct
21 Correct 3 ms 8024 KB Output is correct
22 Correct 3 ms 8020 KB Output is correct
23 Correct 3 ms 8024 KB Output is correct
24 Correct 8 ms 8248 KB Output is correct
25 Correct 28 ms 8280 KB Output is correct
26 Correct 34 ms 8024 KB Output is correct
27 Correct 37 ms 8280 KB Output is correct
28 Correct 14 ms 8024 KB Output is correct
29 Correct 21 ms 8280 KB Output is correct
30 Correct 103 ms 8836 KB Output is correct
31 Correct 64 ms 8620 KB Output is correct
32 Correct 60 ms 9688 KB Output is correct
33 Correct 30 ms 9572 KB Output is correct
34 Correct 1078 ms 10728 KB Output is correct
35 Execution timed out 4014 ms 9328 KB Time limit exceeded
36 Halted 0 ms 0 KB -