Submission #742748

# Submission time Handle Problem Language Result Execution time Memory
742748 2023-05-16T20:29:38 Z keisuke6 Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;
 
vector<map<int,vector<int>>> G(1001,map<int,vector<int>>(5010));
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].emplace_back(v);
    if(!P[i][u]){
      continue;
    }
    deque<int> q;
    q.push_back(u);
    while(!q.empty()){
      int pos = q.front();
      q.pop_front();
      for(int x:G[i][pos]){
        if(P[i][x]){
          if(x <= i) return 1;
          continue;
        }
        P[i][x] = true;
        q.push_back(x);
      }
      G[i][pos].clear();
    }
  }
  return 0;
}

Compilation message

game.cpp:8:8: error: 'map' was not declared in this scope
    8 | vector<map<int,vector<int>>> G(1001,map<int,vector<int>>(5010));
      |        ^~~
game.cpp:6:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    5 | #include <queue>
  +++ |+#include <map>
    6 | using namespace std;
game.cpp:8:26: error: template argument 1 is invalid
    8 | vector<map<int,vector<int>>> G(1001,map<int,vector<int>>(5010));
      |                          ^~
game.cpp:8:26: error: template argument 2 is invalid
game.cpp:8:28: error: expected unqualified-id before '>' token
    8 | vector<map<int,vector<int>>> G(1001,map<int,vector<int>>(5010));
      |                            ^
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:18:5: error: 'G' was not declared in this scope
   18 |     G[i][u].emplace_back(v);
      |     ^