답안 #739847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739847 2023-05-11T11:45:20 Z dubabuba 게임 (APIO22_game) C++17
컴파일 오류
0 ms 0 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

const int mxn = 3e5 + 10;
const int mxm = 5e5 + 10;
vector<int> adj[mxn];
vector<int> rev[mxn];
int n, k;

int cnt_e[mxn], cnt_b[mxn];

vector<int> top;
void tsort() {
  int t[mxn];
  top.cleat();

  queue<int> q;
  for(int i = 0; i < n; i++) {
    t[i] = cnt_e[i];
    if(t[i] == 0)
      q.push(i);
  }

  while(q.size()) {
    int u = q.top();
    top.push_back(u);
    q.pop();

    for(int v : adj[u]) {
      t[v]--;
      if(t[v] == 0)
        q.push(v);
    }
  }
}

void init(int N, int K) {
  n = N;
  k = K;
}

bool in_top[mxn];
int add_teleporter(int u, int v) {
  adj[u].push_back(v);
  rev[v].push_back(u);
  cnt_b[u]++;
  cnt_e[v]++;

  tsort();
  if(top.size() == n)
    return 0;

  memset(in_top, 0, sizeof in_top);
  for(int u : top)
    in_top[u] = 1;

  for(int i = 0; i < k; i++)
    if(!in_top[i])
      return 1;
  return 0;
}

Compilation message

game.cpp: In function 'void tsort()':
game.cpp:17:7: error: 'class std::vector<int>' has no member named 'cleat'; did you mean 'clear'?
   17 |   top.cleat();
      |       ^~~~~
      |       clear
game.cpp:27:15: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   27 |     int u = q.top();
      |               ^~~
      |               pop
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:52:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |   if(top.size() == n)
      |      ~~~~~~~~~~~^~~~