#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<vector<int>,int>P;
#include "dungeon2.h"
void move(int i,int c){
Move(i+1,c+1);
}
int lastroad(){
int res=LastRoad();
if(res==-1)return -1;
return res-1;
}
int color(){
return Color()-1;
}
int cnt[200];
void Inspect(int R){
vector<vector<int>>vs;
queue<P>que;
que.push({});
move(0,1);
move(lastroad(),color());
while(!que.empty()){
auto v=que.front();que.pop();
vs.push_back(v.first);
cnt[v.second]++;
deque<int>b;
for(int u:v.first){
move(u,color());
b.push_front(lastroad());
}
int E=NumberOfRoads();
rep(i,E){
move(i,color());
if(color()!=0){
move(lastroad(),color());
continue;
}
move(lastroad(),1);
v.first.push_back(i);
que.push(P(v.first,v.second+1));
v.first.pop_back();
}
for(int u:b){
move(u,color());
}
}
for(auto&root:vs){
if(root.empty())continue;
for(auto&r:vs){
deque<int>b;
for(int u:r){
move(u,color());
b.push_front(lastroad());
}
move(0,0);
move(lastroad(),color());
for(int u:b){
move(u,color());
}
}
deque<int>b;
for(int u:root){
move(u,color());
b.push_front(lastroad());
}
queue<P>que;
que.push({});
move(0,1);
move(lastroad(),color());
while(!que.empty()){
auto v=que.front();que.pop();
cnt[v.second]++;
deque<int>b;
for(int u:v.first){
move(u,color());
b.push_front(lastroad());
}
int E=NumberOfRoads();
rep(i,E){
move(i,color());
if(color()!=0){
move(lastroad(),color());
continue;
}
move(lastroad(),1);
v.first.push_back(i);
que.push(P(v.first,v.second+1));
v.first.pop_back();
}
for(int u:b){
move(u,color());
}
}
for(int u:b){
move(u,color());
}
}
for(int i=1;i<=R;i++){
Answer(i,cnt[i]/2);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
512 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
512 KB |
Output is correct |
12 |
Correct |
4 ms |
640 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
512 KB |
Output is correct |
3 |
Correct |
4 ms |
512 KB |
Output is correct |
4 |
Correct |
4 ms |
512 KB |
Output is correct |
5 |
Correct |
4 ms |
512 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
4 ms |
512 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
7 ms |
512 KB |
Output is correct |
12 |
Correct |
7 ms |
640 KB |
Output is correct |
13 |
Correct |
5 ms |
512 KB |
Output is correct |
14 |
Correct |
5 ms |
512 KB |
Output is correct |
15 |
Correct |
4 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
768 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |