QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359676#408. Dungeon 2GoodKnightCompile Error//C++202.8kb2024-03-20 19:53:512024-03-20 19:54:21

Judging History

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

  • [2024-03-20 19:54:21]
  • 评测
  • [2024-03-20 19:53:51]
  • 提交

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:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include dungeon2.h
      |          ^~~~~~~~
answer.code: In function ‘void odpowiedz(int)’:
answer.code:44:9: error: ‘Answer’ was not declared in this scope
   44 |         Answer(i, odp[i]);
      |         ^~~~~~
answer.code: In function ‘void inspect(int)’:
answer.code:62:13: error: ‘Move’ was not declared in this scope; did you mean ‘remove’?
   62 |             Move(i, 2);
      |             ^~~~
      |             remove
answer.code:64:25: error: ‘NumberOfRoads’ was not declared in this scope
   64 |         for(int i=1; i<=NumberOfRoads; i++){
      |                         ^~~~~~~~~~~~~
answer.code:65:13: error: ‘Move’ was not declared in this scope; did you mean ‘remove’?
   65 |             Move(i, 2);
      |             ^~~~
      |             remove
answer.code:66:16: error: ‘Color’ was not declared in this scope
   66 |             if(Color()==1){
      |                ^~~~~
answer.code:71:50: error: ‘LastRoad’ was not declared in this scope
   71 |                 nowypokoj.droga.powrot.push_back(LastRoad());
      |                                                  ^~~~~~~~
answer.code:80:16: error: ‘Color’ was not declared in this scope
   80 |             if(Color()==2){
      |                ^~~~~
answer.code:81:22: error: ‘LastRoad’ was not declared in this scope
   81 |                 Move(LastRoad, 3);
      |                      ^~~~~~~~
answer.code:98:39: error: ‘Move’ was not declared in this scope; did you mean ‘remove’?
   98 |         for(auto k : aktdroga.powrot) Move(k, 2);
      |                                       ^~~~
      |                                       remove