提出 #71873273
ソースコード 拡げる
import java.util.Scanner;
import java.util.HashSet;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
if (!scanner.hasNextInt()) {
return;
}
int H = scanner.nextInt();
int W = scanner.nextInt();
int N = scanner.nextInt();
int[][] grid = new int[H][W];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (!scanner.hasNextInt()) {
return;
}
grid[i][j] = scanner.nextInt();
}
}
HashSet<Integer> calledOutNumbers = new HashSet<>();
for (int k = 0; k < N; k++) {
if (!scanner.hasNextInt()) {
return;
}
calledOutNumbers.add(scanner.nextInt());
}
int maxCalledOut = 0;
for (int i = 0; i < H; i++) {
int currentCount = 0;
for (int j = 0; j < W; j++) {
int number = grid[i][j];
if (calledOutNumbers.contains(number)) {
currentCount++;
}
}
if (currentCount > maxCalledOut) {
maxCalledOut = currentCount;
}
}
System.out.println(maxCalledOut);
} catch (InputMismatchException e) {
} catch (Exception e) {
}
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Tombola |
| ユーザ | addy |
| 言語 | Java24 (OpenJDK 24.0.2) |
| 得点 | 200 |
| コード長 | 1747 Byte |
| 結果 | AC |
| 実行時間 | 83 ms |
| メモリ | 41188 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | AC | 83 ms | 40848 KiB |
| 00-sample-02.txt | AC | 72 ms | 40852 KiB |
| 00-sample-03.txt | AC | 72 ms | 40836 KiB |
| 01-01.txt | AC | 70 ms | 40260 KiB |
| 01-02.txt | AC | 73 ms | 40856 KiB |
| 01-03.txt | AC | 76 ms | 40688 KiB |
| 01-04.txt | AC | 73 ms | 40476 KiB |
| 01-05.txt | AC | 75 ms | 41040 KiB |
| 01-06.txt | AC | 71 ms | 40868 KiB |
| 01-07.txt | AC | 73 ms | 40772 KiB |
| 01-08.txt | AC | 75 ms | 41144 KiB |
| 01-09.txt | AC | 75 ms | 41064 KiB |
| 01-10.txt | AC | 73 ms | 40780 KiB |
| 01-11.txt | AC | 73 ms | 40144 KiB |
| 01-12.txt | AC | 78 ms | 40776 KiB |
| 01-13.txt | AC | 73 ms | 40748 KiB |
| 01-14.txt | AC | 75 ms | 40764 KiB |
| 01-15.txt | AC | 73 ms | 40388 KiB |
| 01-16.txt | AC | 77 ms | 40624 KiB |
| 01-17.txt | AC | 76 ms | 41188 KiB |