# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
134673 |
2019-07-23T07:14:39 Z |
이온조(#3239) |
None (JOI16_dungeon2) |
C++14 |
|
2 ms |
760 KB |
#include "dungeon2.h"
#include <bits/stdc++.h>
using namespace std;
const int DBG = 0;
vector<int> adj[209];
int cnt = 2, ans[209][209];
void answer(int D, int A) {
if(DBG) printf("answer: D: %d, A: %d\n", D, A);
Answer(D, A);
}
void move(int I, int C) {
if(DBG) printf("move: I: %d, C: %d\n", I, C);
Move(I, C);
}
void dfs(int x) {
int m = NumberOfRoads(), p = LastRoad();
for(int i=1; i<=m; i++) if(i != p) {
move(i, x);
if(Color() == 1) dfs(++cnt);
else move(LastRoad(), Color());
}
for(int i=1; i<=m; i++) {
move(i, x);
int c = Color(), l = LastRoad();
adj[x].push_back(c);
move(l, c);
}
if(x != 2) move(p, x);
}
void bfs(int st) {
vector<bool> vs(cnt + 1, 0);
queue<int> que; que.push(st); vs[st] = 1;
int ds = 0;
while(que.size()) {
int sz;
ans[st][ds] = sz = que.size();
while(sz--) {
int n = que.front(); que.pop();
for(auto& it: adj[n]) {
if(!vs[it]) {
vs[it] = 1;
que.push(it);
}
}
}
++ds;
}
}
void Inspect(int R) {
dfs(2);
for(int i=2; i<=cnt; i++) bfs(i);
for(int i=1; i<=R; i++) {
int s = 0;
for(int j=2; j<=cnt; j++) s += ans[j][i];
answer(i, s >> 1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
2 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
476 KB |
Output is correct |
8 |
Correct |
2 ms |
504 KB |
Output is correct |
9 |
Correct |
2 ms |
504 KB |
Output is correct |
10 |
Correct |
2 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
504 KB |
Output is correct |
12 |
Correct |
2 ms |
504 KB |
Output is correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
760 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |