Submission #742561

# Submission time Handle Problem Language Result Execution time Memory
742561 2023-05-16T13:03:03 Z keisuke6 Game (APIO22_game) C++17
0 / 100
101 ms 262144 KB
#include "game.h"
#include <iostream>
#include <vector>
#include <unordered_set>
#include <queue>
using namespace std;
 
vector<vector<unordered_set<int>>> G(1001,vector<unordered_set<int>>(30010));
vector<vector<bool>> P(1001,vector<bool>(30010,false));
int N,K;
void init(int n, int k) {
  N = n;
  K = k;
  for(int i=0;i<k;i++)for(int j=i;j<k;j++) P[i][j] = true;
}
 
int add_teleporter(int u, int v) {
  for(int i=0;i<K;i++){
    G[i][u].insert(v);
    if(!P[i][u]){
      continue;
    }
    queue<int> q;
    q.push(u);
    while(!q.empty()){
      int pos = q.front();
      q.pop();
      for(int x:G[i][pos]){
        G[i][pos].erase(x);
        if(P[i][x]){
          if(x <= i) return 1;
          continue;
        }
        P[i][x] = true;
        q.push(x);
      }
    }
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 101 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 101 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 101 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 101 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 101 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -