QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359681#408. Dungeon 2GoodKnightCompile Error//C++202.9kb2024-03-20 19:55:322024-03-20 19:57:08

Judging History

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

  • [2024-03-20 19:57:08]
  • 评测
  • [2024-03-20 19:55:32]
  • 提交

answer

#include<bits/stdc++.h>
#include "dungeon2.h"
using namespace std;
const int N = 52;
struct trasa{
    vector<int> tam;
    vector<int> powrot;
};
struct pokoj{
    int id;
    int color;
    vector<int> koledzy;
    trasa droga;
};
vector<pokoj> lochy;
queue<int> bfs;
int odl[N][N];
int odp[500];
void odpowiedz(int R){
    int n = lochy.size();
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            odl[i][j]=1e9;
        }
        odl[i][i]=0;
        bfs.push(i);
        while(!bfs.empty()){
            int aktu = bfs.front();
            bfs.pop();
            for(auto sas : lochy[aktu].koledzy){
                if (odl[i][sas] >=1e8){
                    odl[i][sas] = odl[i][aktu]+1;
                    bfs.push(sas);
                }
            }
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            odp[odl[i][j]]++;
        }
    }
    for(int i=1; i<=R; i++){
        Answer(i, odp[i]);
    }
}

void inspect (int R){
    pokoj pustypokoj;
    lochy.push_back(pustypokoj);
    pokoj startpokoj;
    startpokoj.id = 1;
    int licznikid = 2;
    startpokoj.color = 1;
    bfs.push(1);
    while(!bfs.empty()){
        int teraz = bfs.front();
        pokoj aktu  = lochy[teraz];
        bfs.pop();
        trasa aktdroga = aktu.droga;
        for(int i : aktdroga.tam){
            Move(i, 2);
        }
        for(int i=1; i<=NumberOfRoads; i++){
            Move(i, 2);
            if(Color()==1){
                pokoj nowypokoj;
                nowypokoj.color = 2;
                nowypokoj.droga.tam = aktu.droga.tam;
                nowypokoj.droga.tam.push_back(i);
                nowypokoj.droga.powrot.push_back(LastRoad());
                for(auto j : aktu.droga.powrot) nowypokoj.droga.powrot.push_back(j);
                nowypokoj.id = licznikid;
                licznikid++;
                nowypokoj.koledzy.push_back(teraz);
                lochy[teraz].koledzy.push_back(nowypokoj.id);
                bfs.push(nowypokoj.id);
                Move(LastRoad(), 2);
            }
            if(Color()==2){
                Move(LastRoad, 3);
                int toOn = 0;
                for(auto j : aktdroga.powrot) Move(j, 2);
                for(int j=1; j<lochy.size(); j++){
                    for(int k : lochy[j].droga.tam) Move(k, 2);
                    if(Color()==3){
                        toOn = j;
                    }
                    for(int k : lochy[j].droga.powrot) Move(k, 2);
                }
                if(toOn==0) cout << "Fail ";
                else{
                    lochy[teraz].koledzy.push_back(toOn);
                    lochy[toOn].koledzy.push_back(teraz);
                }
            }
        }
        for(auto k : aktdroga.powrot) Move(k, 2);
    }
    odpowiedz(R);
}

详细

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:64:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   64 |         for(int i=1; i<=NumberOfRoads; i++){
      |                      ~^~~~~~~~~~~~~~~
answer.code:81:22: error: invalid conversion from ‘int (*)()’ to ‘int’ [-fpermissive]
   81 |                 Move(LastRoad, 3);
      |                      ^~~~~~~~
      |                      |
      |                      int (*)()
In file included from answer.code:2:
dungeon2.h:3:15: note:   initializing argument 1 of ‘void Move(int, int)’
    3 | void Move(int I, int V);
      |           ~~~~^