QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359791#408. Dungeon 2robsob20060 0ms0kbC++143.6kb2024-03-20 20:56:152024-03-20 20:56:17

Judging History

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

  • [2024-03-20 20:56:17]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-03-20 20:56:15]
  • 提交

answer

#include <bits/stdc++.h>
#include "dungeon2.h"

using namespace std;

struct vertex{
    vector <int> path_to;
    vector <int> path_from;
};

vector <vertex> od_jedynki;
vector <vertex> od_randoma;
queue <int> nexty;
int liczba_ziomkow, liczba_ziomkow2;
int wynik[200007];
int odl[200007];
/*
int NumberOfRoads(){
    int n;
    cout << "NUMBER OF ROADS\n";
    cin >> n;
    return n;
}

int LastRoad(){
    int n;
    cout << "LAST ROAD\n";
    cin >> n;
    return n;
}

int Color(){
    int n;
    cout << "COLOR\n";
    cin >> n;
    return n;
}

void Move(int indeks, int kolor){
    cout << "MOVE: " << indeks << ' ' << kolor << '\n';
    return;
}

void Answer(int d, int a){
    cout << "ANSWER: " << d << ' ' << a << '\n';
    return;
}
*/

void bfs1(int id){
    int somsiedzi=NumberOfRoads();
    for(int i=1; i<=somsiedzi; i++){
        Move(i, 2);
        if(Color()!=2){
            od_jedynki.push_back({od_jedynki[id].path_to, od_jedynki[id].path_from});
            od_jedynki[liczba_ziomkow].path_to.push_back(i);
            od_jedynki[liczba_ziomkow].path_from.push_back(LastRoad());
            nexty.push(liczba_ziomkow);
            liczba_ziomkow++;
        }
        Move(LastRoad(), 2);
    }
}

void bfs(int id, int cool){
    int somsiedzi=NumberOfRoads();
    for(int i=1; i<=somsiedzi; i++){
        Move(i, 2);
        if(Color()!=2){
            od_randoma.push_back({od_randoma[id].path_to, od_randoma[id].path_from});
            od_randoma[liczba_ziomkow2].path_to.push_back(i);
            od_randoma[liczba_ziomkow2].path_from.push_back(LastRoad());
            nexty.push(liczba_ziomkow2);
            odl[liczba_ziomkow2]=odl[id]+1;
            liczba_ziomkow2++;
        }
        Move(LastRoad(), 2);
    }
}

void Inspect(int r){
    int i, j, v, a, b;
    liczba_ziomkow=1;
    od_jedynki.push_back({{}, {}});
    //bfs od 1
    nexty.push(0);
    while(!nexty.empty()){
        v=nexty.front();
        nexty.pop();
        for(i=0; i<od_jedynki[v].path_to.size(); i++){
            Move(od_jedynki[v].path_to[i], 2);
        }
        bfs1(v);
        for(i=0; i<od_jedynki[v].path_from.size(); i++){
            Move(od_jedynki[v].path_from[i], 2);
        }
    }
    for(v=0; v<liczba_ziomkow; v++){
        for(j=0; j<liczba_ziomkow; j++){
            for(i=0; i<od_jedynki[j].path_to.size(); i++){
                Move(od_jedynki[j].path_to[i], 1);
            }
            for(i=0; i<od_jedynki[j].path_from.size(); i++){
                Move(od_jedynki[j].path_from[i], 1);
            }
        }
        for(i=0; i<od_jedynki[v].path_to.size(); i++){
            Move(od_jedynki[v].path_to[i], 1);
        }
        od_randoma.push_back({{}, {}});
        liczba_ziomkow2=1;
        //bfs od randoma
        nexty.push(0);
        while(!nexty.empty()){
            v=nexty.front();
            nexty.pop();
            for(i=0; i<od_randoma[v].path_to.size(); i++){
                Move(od_randoma[v].path_to[i], 2);
            }
            bfs1(v);
            for(i=0; i<od_randoma[v].path_from.size(); i++){
                Move(od_randoma[v].path_from[i], 2);
            }
        }
        for(i=0; i<od_jedynki[v].path_from.size(); i++){
            Move(od_jedynki[v].path_from[i], 1);
        }
        od_randoma.clear();
        for(j=0; j<liczba_ziomkow; j++){
            wynik[odl[j]]++;
            odl[j]=0;
        }
    }
    for(i=1; i<=r; i++){
        Answer(i, wynik[i]/2);
    }
}
/*
int main()
{
    int r;
    cin >> r;
    Inspect(r);
    return 0;
}
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

10 100 50
7
5 7 10 4 6 2 3
2
1 5
3
1 10 7
2
10 1
3
1 9 2
2
1 7
5
9 6 8 3 1
1
7
2
5 7
3
1 4 3
15
24
6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

Wrong Answer [5]

result:


Subtask #2:

score: 0
Runtime Error

Test #16:

score: 0
Runtime Error

input:

10 3 50
4
7 4 10 5
2
8 6
1
10
2
1 9
3
1 7 10
2
7 2
5
6 1 5 8 9
3
7 9 2
4
10 8 7 4
4
1 9 5 3
15
19
9
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

output:

Wrong Answer [5]

result:


Subtask #3:

score: 0
Runtime Error

Test #31:

score: 0
Runtime Error

input:

200 3 200
6
149 79 143 164 179 68
4
44 52 144 113
1
84
3
31 188 166
1
109
4
154 192 125 147
1
198
4
103 27 192 95
3
33 166 179
1
125
3
31 61 150
3
168 152 161
2
67 64
1
136
2
150 17
1
192
2
15 142
2
56 122
1
35
2
97 200
2
129 22
4
72 134 31 21
2
53 82
4
195 181 104 146
1
78
1
88
3
8 78 127
4
152 200...

output:

Wrong Answer [5]

result: