提出 #70625638
ソースコード 拡げる
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] line = br.readLine().split(" ");
int N = Integer.parseInt(line[0]);
int M = Integer.parseInt(line[1]);
String[] grid = new String[N];
for (int i = 0; i < N; i++) {
grid[i] = br.readLine();
}
Set<String> patterns = new HashSet<>();
for (int i = 0; i <= N - M; i++) {
for (int j = 0; j <= N - M; j++) {
StringBuilder pattern = new StringBuilder();
for (int x = i; x < i + M; x++) {
for (int y = j; y < j + M; y++) {
pattern.append(grid[x].charAt(y));
}
}
patterns.add(pattern.toString());
}
}
System.out.println(patterns.size());
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Count Subgrid |
| ユーザ | addy |
| 言語 | Java24 (OpenJDK 24.0.2) |
| 得点 | 250 |
| コード長 | 1060 Byte |
| 結果 | AC |
| 実行時間 | 52 ms |
| メモリ | 38312 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 250 / 250 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | 1000000007_01.txt, 1000000007_02.txt, 998244353_01.txt, 998244353_02.txt, 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, sample_01.txt, sample_02.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 1000000007_01.txt | AC | 52 ms | 37872 KiB |
| 1000000007_02.txt | AC | 45 ms | 37720 KiB |
| 998244353_01.txt | AC | 45 ms | 38044 KiB |
| 998244353_02.txt | AC | 45 ms | 38040 KiB |
| random_01.txt | AC | 44 ms | 37608 KiB |
| random_02.txt | AC | 45 ms | 37900 KiB |
| random_03.txt | AC | 45 ms | 38312 KiB |
| random_04.txt | AC | 44 ms | 37692 KiB |
| random_05.txt | AC | 45 ms | 37880 KiB |
| random_06.txt | AC | 45 ms | 37916 KiB |
| random_07.txt | AC | 45 ms | 38152 KiB |
| random_08.txt | AC | 44 ms | 37820 KiB |
| random_09.txt | AC | 45 ms | 37872 KiB |
| random_10.txt | AC | 45 ms | 37944 KiB |
| random_11.txt | AC | 46 ms | 38028 KiB |
| random_12.txt | AC | 45 ms | 37644 KiB |
| random_13.txt | AC | 45 ms | 37764 KiB |
| sample_01.txt | AC | 44 ms | 38056 KiB |
| sample_02.txt | AC | 45 ms | 38196 KiB |