QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359752#408. Dungeon 2user1234Compile Error//C++141.3kb2024-03-20 20:37:412024-03-20 20:37:41

Judging History

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

  • [2024-03-20 20:37:41]
  • 评测
  • [2024-03-20 20:37:41]
  • 提交

answer

#include <bits/stdc++.h>
#include "dungeon2.h"
using namespace std;
int aktualny = 2;
vector <short> sasiedzi[204];
//int numer_ojca[204];
short n, m;
int odleglosci[201];
int zaglebienie[203];
void dfs() {
    int k = NumberOfRoads();
    int kolor = aktualny;
    int hoplita;
    aktualny++;
    for (int i = 1; i <= k; i++) {
        Move(i, kolor);
        int jak_wracamy = LastRoad();
        if (Color() == 1) {
            hoplita = aktualny;
            sasiedzi[hoplita].push_back(aktualny);
            sasiedzi[aktualny].push_back(hoplita);
            dfs();
        }
        else hoplita = Color();
        Move(jak_wracamy, hoplita);
    }
}
void bfs(int x) {
    if (!sasiedzi[x].size()) return;
    fill(zaglebienie + 2, zaglebienie + 203, -1);
    zaglebienie[x] = 0;
    queue <int> kolejka;
    kolejka.push(x);
    while (!kolejka.empty()) {
        int v = kolejka.front();
        kolejka.pop();
        for (int sasiad : sasiedzi[v]) {
            if (zaglebienie[sasiad] != -1) continue;
            zaglebienie[sasiad] = zaglebienie[x] + 1;
            odleglosci[zaglebienie[sasiad]]++;
            kolejka.push(sasiad);
        }
    }

}
void Inspect(int R) {
    dfs();
    for (int i = 2; i <= 201) bfs(i);
    for (int i = 1; i <= R; i++) Answer(i, odleglosci[i] / 2);
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:94:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   94 |                 scanf("%d", &(n_roads[i]));
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~
implementer.cpp:98:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   98 |                         scanf("%d", &(road[i][j]));
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~
implementer.cpp:105:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  105 |                 scanf("%d", &(expected_answer[i]));
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘void Inspect(int)’:
answer.code:48:29: error: expected ‘;’ before ‘)’ token
   48 |     for (int i = 2; i <= 201) bfs(i);
      |                             ^
      |                             ;