QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359710#408. Dungeon 2GoodKnightCompile Error//C++202.9kb2024-03-20 20:08:342024-03-20 20:08:36

Judging History

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

  • [2024-03-20 20:08:36]
  • 评测
  • [2024-03-20 20:08:34]
  • 提交

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, Color());
        }
        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, Color());
                for(int j=1; j<lochy.size(); j++){
                    for(int k : lochy[j].droga.tam) Move(k, Color());
                    if(Color()==3){
                        toOn = j;
                    }
                    for(int k : lochy[j].droga.powrot) Move(k, Color());
                }
                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, Color());
    }
    odpowiedz(R);
}

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:92:17: error: expected primary-expression before ‘else’
   92 |                 else{
      |                 ^~~~