提出 #74665785
ソースコード 拡げる
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] A = new int[N];
int[] B = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
B[i] = sc.nextInt();
}
int M = sc.nextInt();
String[] S = new String[M];
for (int i = 0; i < M; i++) {
S[i] = sc.next();
}
boolean[][] allowed = new boolean[N][26];
for (int i = 0; i < N; i++) {
for (String str : S) {
if (str.length() == A[i]) {
char ch = str.charAt(B[i] - 1);
allowed[i][ch - 'a'] = true;
}
}
}
StringBuilder ans = new StringBuilder();
for (String spine : S) {
if (spine.length() != N) {
ans.append("No\n");
continue;
}
boolean valid = true;
for (int i = 0; i < N; i++) {
char ch = spine.charAt(i);
if (!allowed[i][ch - 'a']) {
valid = false;
break;
}
}
ans.append(valid ? "Yes\n" : "No\n");
}
System.out.print(ans);
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Fishbones |
| ユーザ | KDeepa |
| 言語 | Java24 (OpenJDK 24.0.2) |
| 得点 | 300 |
| コード長 | 1392 Byte |
| 結果 | AC |
| 実行時間 | 444 ms |
| メモリ | 83828 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt |
| All | 00-sample-01.txt, 00-sample-02.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, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | AC | 78 ms | 40536 KiB |
| 00-sample-02.txt | AC | 69 ms | 40764 KiB |
| 01-01.txt | AC | 149 ms | 49620 KiB |
| 01-02.txt | AC | 262 ms | 64188 KiB |
| 01-03.txt | AC | 351 ms | 70796 KiB |
| 01-04.txt | AC | 262 ms | 64828 KiB |
| 01-05.txt | AC | 310 ms | 70688 KiB |
| 01-06.txt | AC | 293 ms | 64632 KiB |
| 01-07.txt | AC | 379 ms | 81468 KiB |
| 01-08.txt | AC | 434 ms | 80704 KiB |
| 01-09.txt | AC | 143 ms | 49212 KiB |
| 01-10.txt | AC | 310 ms | 64896 KiB |
| 01-11.txt | AC | 149 ms | 48976 KiB |
| 01-12.txt | AC | 339 ms | 72916 KiB |
| 01-13.txt | AC | 299 ms | 64588 KiB |
| 01-14.txt | AC | 276 ms | 64576 KiB |
| 01-15.txt | AC | 383 ms | 80528 KiB |
| 01-16.txt | AC | 429 ms | 80996 KiB |
| 01-17.txt | AC | 427 ms | 81600 KiB |
| 01-18.txt | AC | 440 ms | 81448 KiB |
| 01-19.txt | AC | 403 ms | 81592 KiB |
| 01-20.txt | AC | 417 ms | 83828 KiB |
| 01-21.txt | AC | 444 ms | 81416 KiB |
| 01-22.txt | AC | 429 ms | 81608 KiB |
| 01-23.txt | AC | 427 ms | 82008 KiB |