Submission #44047999


Source Code Expand

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++) {
				String s = scanner.next();
				for (int j = 0; j < m; j++) {
					map[i][j] = s.charAt(j);
				}
			}

			for (int i = 0; i <= n - 9; i++) {
				for (int j = 0; j <= m - 9; j++) {
					if (map[i][j] != '#' || map[i][j + 1] != '#' || map[i][j + 2] != '#' || map[i][j + 3] != '.') {
						continue;
					}
					if (map[i + 1][j] != '#' || map[i + 1][j + 1] != '#' || map[i + 1][j + 2] != '#' || map[i + 1][j + 3] != '.') {
						continue;
					}
					if (map[i + 2][j] != '#' || map[i + 2][j + 1] != '#' || map[i + 2][j + 2] != '#' || map[i + 2][j + 3] != '.') {
						continue;
					}
					if (map[i + 3][j] != '.' || map[i + 3][j + 1] != '.' || map[i + 3][j + 2] != '.' || map[i + 3][j + 3] != '.') {
						continue;
					}

					if (map[i + 5][j + 5] != '.' || map[i + 5][j + 6] != '.' || map[i + 5][j + 7] != '.' || map[i + 5][j + 8] != '.') {
						continue;
					}
					if (map[i + 6][j + 5] != '.' || map[i + 6][j + 6] != '#' || map[i + 6][j + 7] != '#' || map[i + 6][j + 8] != '#') {
						continue;
					}
					if (map[i + 7][j + 5] != '.' || map[i + 7][j + 6] != '#' || map[i + 7][j + 7] != '#' || map[i + 7][j + 8] != '#') {
						continue;
					}
					if (map[i + 8][j + 5] != '.' || map[i + 8][j + 6] != '#' || map[i + 8][j + 7] != '#' || map[i + 8][j + 8] != '#') {
						continue;
					}

					System.out.println((i + 1) + " " + (j + 1));
				}
			}
		}
	}
}

Submission Info

Submission Time
Task B - TaK Code
User kmatsu
Language Java (OpenJDK 11.0.6)
Score 200
Code Size 1707 Byte
Status AC
Exec Time 183 ms
Memory 40904 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 17
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 183 ms 37080 KiB
random_02.txt AC 153 ms 39372 KiB
random_03.txt AC 136 ms 38700 KiB
random_04.txt AC 149 ms 38944 KiB
random_05.txt AC 151 ms 40904 KiB
random_06.txt AC 157 ms 39952 KiB
random_07.txt AC 147 ms 39248 KiB
random_08.txt AC 141 ms 38776 KiB
random_09.txt AC 152 ms 39208 KiB
random_10.txt AC 160 ms 39252 KiB
random_11.txt AC 154 ms 39096 KiB
random_12.txt AC 154 ms 39092 KiB
random_13.txt AC 159 ms 39160 KiB
random_14.txt AC 177 ms 39168 KiB
sample_01.txt AC 136 ms 38600 KiB
sample_02.txt AC 135 ms 38636 KiB
sample_03.txt AC 106 ms 35552 KiB