Submission #26232

# Submission time Handle Problem Language Result Execution time Memory
26232 2017-06-28T12:36:07 Z kdh9949 None (JOI16_dungeon2) C++14
90 / 100
23 ms 2232 KB
#include "dungeon2.h"
#include <vector>
using namespace std;

static const int inf = 1e9, thr[5] = {1, 3, 9, 27, 81};
static int n, cnt[201], md[201][201];
static vector<int> te[201], e[201];

void f(){
	int x = n++;
	int en = NumberOfRoads();
	for(int i = 1; i <= en; i++){
		Move(i, 2);
		int b = LastRoad();
		int nc = Color();
		te[x].push_back(nc);
		if(nc == 1){
			e[x].push_back(n);
			f();
			nc = 3;
		}
		else e[x].push_back(0);
		Move(b, nc);
	}
}

int get(int x, int t){ return (x / thr[t]) % 3 + 1; }

void g(int t){
	int x = n++;
	int en = NumberOfRoads();
	for(int i = 0; i < en; i++){
		if(te[x][i] == 3) continue;
		Move(i + 1, get(x, t));
		int b = LastRoad();
		if(te[x][i] == 1) g(t);
		else{
			e[x][i] += (Color() - 1) * thr[t];
		}
		Move(b, Color());
	}
}

void h(int r){
	for(int i = 1; i < n; i++) fill(md[i] + 1, md[i] + n, inf);
	for(int i = 1; i < n; i++) for(auto &j : e[i]) md[i][j] = md[j][i] = 1;
	for(int k = 1; k < n; k++){
		for(int i = 1; i < n; i++){
			for(int j = 1; j < n; j++){
				md[i][j] = min(md[i][j], md[i][k] + md[k][j]);
			}
		}
	}
	for(int i = 1; i < n; i++){
		for(int j = i + 1; j < n; j++){
			cnt[md[i][j]]++;
		}
	}
	for(int i = 1; i <= r; i++) Answer(i, cnt[i]);
}

void Inspect(int R){
	n = 1;
	f();
	for(int i = 0; i < 5; i++){ n = 1; g(i); }
	h(R);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1836 KB Output is correct
2 Correct 0 ms 1836 KB Output is correct
3 Correct 0 ms 1836 KB Output is correct
4 Correct 0 ms 1836 KB Output is correct
5 Correct 0 ms 1836 KB Output is correct
6 Correct 0 ms 1836 KB Output is correct
7 Correct 0 ms 1836 KB Output is correct
8 Correct 0 ms 1836 KB Output is correct
9 Correct 0 ms 1836 KB Output is correct
10 Correct 0 ms 1836 KB Output is correct
11 Correct 0 ms 1836 KB Output is correct
12 Correct 0 ms 1836 KB Output is correct
13 Correct 0 ms 1836 KB Output is correct
14 Correct 0 ms 1836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1836 KB Output is correct
2 Correct 0 ms 1836 KB Output is correct
3 Correct 0 ms 1836 KB Output is correct
4 Correct 0 ms 1836 KB Output is correct
5 Correct 0 ms 1836 KB Output is correct
6 Correct 0 ms 1836 KB Output is correct
7 Correct 0 ms 1836 KB Output is correct
8 Correct 0 ms 1836 KB Output is correct
9 Correct 0 ms 1836 KB Output is correct
10 Correct 0 ms 1836 KB Output is correct
11 Correct 0 ms 1836 KB Output is correct
12 Correct 0 ms 1836 KB Output is correct
13 Correct 0 ms 1836 KB Output is correct
14 Correct 0 ms 1836 KB Output is correct
15 Correct 0 ms 1836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 9 ms 1836 KB Partially correct
2 Partially correct 9 ms 1836 KB Partially correct
3 Partially correct 9 ms 1836 KB Partially correct
4 Partially correct 23 ms 2232 KB Partially correct
5 Partially correct 0 ms 1836 KB Partially correct
6 Partially correct 0 ms 1836 KB Partially correct
7 Partially correct 9 ms 1836 KB Partially correct
8 Partially correct 13 ms 1836 KB Partially correct
9 Partially correct 9 ms 1836 KB Partially correct
10 Partially correct 9 ms 1836 KB Partially correct
11 Partially correct 9 ms 1836 KB Partially correct
12 Partially correct 9 ms 1836 KB Partially correct
13 Partially correct 13 ms 1968 KB Partially correct
14 Partially correct 13 ms 1836 KB Partially correct
15 Partially correct 9 ms 1836 KB Partially correct
16 Partially correct 3 ms 1968 KB Partially correct
17 Partially correct 23 ms 2232 KB Partially correct
18 Partially correct 23 ms 2232 KB Partially correct
19 Partially correct 19 ms 2232 KB Partially correct