QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#34675#4251. Gamelunchbox#Compile Error//C++17719b2022-06-12 04:36:542024-05-26 00:51:52

Judging History

你现在查看的是最新测评结果

  • [2024-05-26 00:51:52]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-12 04:36:54]
  • 提交

answer

#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")

#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 30000;

std::vector<int> ej[N];
int ww[N], tt[N], n;

void init(int n_, int k) {
  n = n_;
  for (int i = 0; i < n; i++)
    ej[i].clear(), ww[i] = 0;
  for (int i = 0; i < k - 1; i++)
    ej[i].push_back(i + 1), ww[i + 1]++;
}

int add_teleporter(int u, int v) {
  queue<int> qu;

  ej[u].push_back(v), ww[v]++;

  for (int i = 0; i < n; i++)
    if ((tt[i] = ww[i]) == 0)
      qu.push(i);

  while (qu.size()) {
    int i = qu.front(); qu.pop();

    for (int j : ej[i])
      if (--tt[j] == 0)
        qu.push(j);
  }
  return head != n;
}

Details

answer.code: In function ‘int add_teleporter(int, int)’:
answer.code:37:10: error: ‘head’ was not declared in this scope
   37 |   return head != n;
      |          ^~~~