AtCoder Regular Contest 006

Submission #1389415

Source codeソースコード

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int H, W;
vector<string> board;

int dfs(int y, int x) {
	if (board[y][x] == '.') return 0;
	board[y][x] = '.';
	int ans = 1;
	for (int vy = -1; vy <= 1; vy++){
		for (int vx = -1; vx <= 1; vx++){
			ans += dfs(y + vy, x + vx);
		}
	}
	return ans;
}

int calc(int a) {
	for (int i = 2; i * i <= a; i++){
		while (a % (i * i) == 0) a /= (i * i);
	}
	return a;
}

int main() {
	cin >> H >> W;
	board = vector<string>(H);
	for (int i = 0; i < H; i++){
		cin >> board[i];
	}
	vector<int> ans(16, 0);
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			ans[calc(dfs(i, j))]++;
		}
	}
	cout << ans[3] << " " << ans[1] << " " << ans[11] << endl;
}

Submission

Task問題 D - アルファベット探し
User nameユーザ名 chokudai
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 770 Byte
File nameファイル名
Exec time実行時間 59 ms
Memory usageメモリ使用量 21376 KB

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 00_min.txt,00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,00_sample_04.txt,00_sample_05.txt,01_rndsmall_00.txt,01_rndsmall_01.txt,01_rndsmall_02.txt,01_rndsmall_03.txt,01_rndsmall_04.txt,01_rndsmall_05.txt,01_rndsmall_06.txt,01_rndsmall_07.txt,01_rndsmall_08.txt,01_rndsmall_09.txt,01_rndsmall_10.txt,01_rndsmall_11.txt,01_rndsmall_12.txt,01_rndsmall_13.txt,01_rndsmall_14.txt,01_rndsmall_15.txt,01_rndsmall_16.txt,01_rndsmall_17.txt,01_rndsmall_18.txt,01_rndsmall_19.txt,02_rndmax_00.txt,02_rndmax_01.txt,02_rndmax_02.txt,02_rndmax_03.txt,02_rndmax_04.txt,02_rndmax_05.txt,02_rndmax_06.txt,02_rndmax_07.txt,02_rndmax_08.txt,02_rndmax_09.txt,02_rndmax_10.txt,02_rndmax_11.txt,02_rndmax_12.txt,02_rndmax_13.txt,02_rndmax_14.txt,02_rndmax_15.txt,02_rndmax_16.txt,02_rndmax_17.txt,02_rndmax_18.txt,02_rndmax_19.txt,03_rnd_00.txt,03_rnd_01.txt,03_rnd_02.txt,03_rnd_03.txt,03_rnd_04.txt,03_rnd_05.txt,03_rnd_06.txt,03_rnd_07.txt,03_rnd_08.txt,03_rnd_09.txt,04_empty_00.txt,05_maxret_00.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_min.txt AC 1 ms 256 KB
00_sample_01.txt AC 1 ms 256 KB
00_sample_02.txt AC 1 ms 256 KB
00_sample_03.txt AC 1 ms 256 KB
00_sample_04.txt AC 1 ms 256 KB
00_sample_05.txt AC 1 ms 256 KB
01_rndsmall_00.txt AC 2 ms 256 KB
01_rndsmall_01.txt AC 2 ms 384 KB
01_rndsmall_02.txt AC 2 ms 256 KB
01_rndsmall_03.txt AC 2 ms 256 KB
01_rndsmall_04.txt AC 2 ms 256 KB
01_rndsmall_05.txt AC 2 ms 256 KB
01_rndsmall_06.txt AC 2 ms 256 KB
01_rndsmall_07.txt AC 2 ms 256 KB
01_rndsmall_08.txt AC 2 ms 256 KB
01_rndsmall_09.txt AC 2 ms 256 KB
01_rndsmall_10.txt AC 2 ms 256 KB
01_rndsmall_11.txt AC 2 ms 256 KB
01_rndsmall_12.txt AC 2 ms 256 KB
01_rndsmall_13.txt AC 2 ms 256 KB
01_rndsmall_14.txt AC 2 ms 256 KB
01_rndsmall_15.txt AC 2 ms 256 KB
01_rndsmall_16.txt AC 2 ms 256 KB
01_rndsmall_17.txt AC 2 ms 256 KB
01_rndsmall_18.txt AC 2 ms 256 KB
01_rndsmall_19.txt AC 2 ms 256 KB
02_rndmax_00.txt AC 40 ms 1920 KB
02_rndmax_01.txt AC 42 ms 1920 KB
02_rndmax_02.txt AC 43 ms 1408 KB
02_rndmax_03.txt AC 42 ms 1792 KB
02_rndmax_04.txt AC 43 ms 1536 KB
02_rndmax_05.txt AC 43 ms 2176 KB
02_rndmax_06.txt AC 54 ms 16384 KB
02_rndmax_07.txt AC 46 ms 7168 KB
02_rndmax_08.txt AC 42 ms 2048 KB
02_rndmax_09.txt AC 41 ms 1920 KB
02_rndmax_10.txt AC 41 ms 2048 KB
02_rndmax_11.txt AC 42 ms 2688 KB
02_rndmax_12.txt AC 41 ms 1920 KB
02_rndmax_13.txt AC 48 ms 10368 KB
02_rndmax_14.txt AC 59 ms 21376 KB
02_rndmax_15.txt AC 43 ms 1792 KB
02_rndmax_16.txt AC 43 ms 4224 KB
02_rndmax_17.txt AC 42 ms 3584 KB
02_rndmax_18.txt AC 42 ms 2560 KB
02_rndmax_19.txt AC 42 ms 1920 KB
03_rnd_00.txt AC 2 ms 256 KB
03_rnd_01.txt AC 11 ms 896 KB
03_rnd_02.txt AC 10 ms 512 KB
03_rnd_03.txt AC 12 ms 1152 KB
03_rnd_04.txt AC 13 ms 896 KB
03_rnd_05.txt AC 4 ms 512 KB
03_rnd_06.txt AC 17 ms 896 KB
03_rnd_07.txt AC 6 ms 512 KB
03_rnd_08.txt AC 25 ms 4096 KB
03_rnd_09.txt AC 19 ms 1024 KB
04_empty_00.txt AC 38 ms 1280 KB
05_maxret_00.txt AC 48 ms 1280 KB