提出 #74669625
ソースコード 拡げる
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
@SuppressWarnings("DuplicatedCode")
public class Main {
static int MAX_STRING_LENGTH = (int) 1e6; // 字符串最大长度
static int MAX_DIGIT_LENGTH = (int) 1e6; // 数位最大长度
static int MOD7 = (int) 1e9 + 7, MOD8 = 80112002, MOD9 = 998244353, inf = Integer.MAX_VALUE;
/***** 检查 T *****/
static class Solution {
void solve() {
int n = io.nextInt();
int[][] g = new int[n][];
for (int i = 0; i < n; i++) {
g[i] = io.nextIntArray(2);
}
int m = io.nextInt();
char[][] ws = new char[m][];
int[][] mask = new int[11][11];
for (int i = 0; i < m; i++) {
char[] s = io.nextCharArray(true);
ws[i] = s;
int k = s.length;
for (int j = 0; j < k; j++) {
mask[k][j] |= 1 << s[j] - 'a';
}
}
out: for (int i = 0; i < m; i++) {
char[] s = ws[i];
int k = s.length;
if (k != n) {
io.println("No");
continue;
}
for (int j = 0; j < k; j++) {
if ((mask[g[j][0]][g[j][1] - 1] & 1 << s[j] - 'a') == 0) {
io.println("No");
continue out;
}
}
io.println("Yes");
}
}
}
public static void main(String[] args) {
io = new IO();
int T = 1;
// T = io.nextInt();
for (; T > 0; T--) {
new Solution().solve();
}
io.close();
}
static IO io;
static class IO {
BufferedInputStream bis = new BufferedInputStream(System.in);
PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));
int nextInt() {
return (int) nextLong();
}
long nextLong() {
try {
long sign = 1, x = 0;
int c = bis.read();
while (c < '0' || c > '9') {
if (c == '-') sign = -1;
c = bis.read();
}
while (c >= '0' && c <= '9') {
x = x * 10 + (c - '0');
c = bis.read();
}
return sign * x;
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
}
}
int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) {
try {
int sign = 1, x = 0;
int c = bis.read();
while (c < '0' || c > '9') {
if (c == '-') sign = -1;
c = bis.read();
}
while (c >= '0' && c <= '9') {
x = x * 10 + (c - '0');
c = bis.read();
}
a[i] = sign * x;
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
}
}
return a;
}
long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++) {
try {
long sign = 1, x = 0;
int c = bis.read();
while (c < '0' || c > '9') {
if (c == '-') sign = -1;
c = bis.read();
}
while (c >= '0' && c <= '9') {
x = x * 10 + (c - '0');
c = bis.read();
}
a[i] = sign * x;
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
}
}
return a;
}
int[] nextDigitArray(int n) {
try {
int[] a = new int[n];
int x = bis.read();
while (ignore(x)) {
x = bis.read();
}
int i = 0;
while (!ignore(x)) {
a[i++] = x - '0';
x = bis.read();
}
return a;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
private int[] DIGIT_ARRAY;
int[] nextDigitArray() {
try {
if (DIGIT_ARRAY == null) {
DIGIT_ARRAY = new int[MAX_DIGIT_LENGTH];
}
int x = bis.read();
while (ignore(x)) {
x = bis.read();
}
int m = 0;
while (!ignore(x)) {
DIGIT_ARRAY[m++] = x - '0';
x = bis.read();
}
int[] a = new int[m];
System.arraycopy(DIGIT_ARRAY, 0, a, 0, m);
return a;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
char nextChar() {
try {
int x = bis.read();
while (ignore(x)) {
x = bis.read();
}
return (char) x;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
String[] nextStringArray(int n) {
String[] a = new String[n];
for (int i = 0; i < n; i++) {
try {
if (CHAR_ARRAY == null) {
CHAR_ARRAY = new char[MAX_STRING_LENGTH];
}
int x = bis.read();
while (ignore(x)) {
x = bis.read();
}
int m = 0;
while (x != ' ' && x != ',' && !ignore(x)) {
CHAR_ARRAY[m++] = (char) x;
x = bis.read();
}
a[i] = new String(CHAR_ARRAY, 0, m);
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
}
}
return a;
}
private char[] CHAR_ARRAY;
char[] nextCharArray(boolean line) {
try {
if (CHAR_ARRAY == null) {
CHAR_ARRAY = new char[MAX_STRING_LENGTH];
}
int x = bis.read();
while (ignore(x)) {
x = bis.read();
}
int m = 0;
while (line ? (x == ' ' || x == ',' || !ignore(x)) : !ignore(x)) {
CHAR_ARRAY[m++] = (char) x;
x = bis.read();
}
char[] a = new char[m];
System.arraycopy(CHAR_ARRAY, 0, a, 0, m);
return a;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
char[] nextCharArray(int n) {
try {
char[] a = new char[n];
int x = bis.read();
while (ignore(x)) {
x = bis.read();
}
int i = 0;
while (!ignore(x)) {
a[i++] = (char) x;
x = bis.read();
}
return a;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
private boolean ignore(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
String nextString(boolean line) {
return new String(nextCharArray(line));
}
String nextString() {
return nextString(false);
}
boolean nextBoolean() {
return "true".equalsIgnoreCase(nextString());
}
double nextDouble() {
return Double.parseDouble(nextString());
}
void println(Object obj) {
print(obj);
print("\n");
}
void println() {
print('\n');
}
void print(Object obj) {
pw.print(obj);
}
void printf(String format, Object... obj) {
pw.printf(format, obj);
}
void close() {
try {
if (bis != null) bis.close();
if (pw != null) {
pw.flush();
pw.close();
}
bis = null;
pw = null;
} catch (Exception ignore) {
}
}
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Fishbones |
| ユーザ | gaoyuliang |
| 言語 | Java24 (OpenJDK 24.0.2) |
| 得点 | 300 |
| コード長 | 9410 Byte |
| 結果 | AC |
| 実行時間 | 203 ms |
| メモリ | 55120 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 | 46 ms | 39960 KiB |
| 00-sample-02.txt | AC | 41 ms | 40152 KiB |
| 01-01.txt | AC | 87 ms | 43592 KiB |
| 01-02.txt | AC | 120 ms | 46588 KiB |
| 01-03.txt | AC | 169 ms | 49532 KiB |
| 01-04.txt | AC | 126 ms | 46720 KiB |
| 01-05.txt | AC | 153 ms | 50028 KiB |
| 01-06.txt | AC | 134 ms | 48188 KiB |
| 01-07.txt | AC | 166 ms | 51336 KiB |
| 01-08.txt | AC | 175 ms | 51320 KiB |
| 01-09.txt | AC | 87 ms | 43796 KiB |
| 01-10.txt | AC | 132 ms | 47240 KiB |
| 01-11.txt | AC | 87 ms | 44224 KiB |
| 01-12.txt | AC | 154 ms | 49444 KiB |
| 01-13.txt | AC | 143 ms | 47884 KiB |
| 01-14.txt | AC | 118 ms | 46688 KiB |
| 01-15.txt | AC | 171 ms | 51312 KiB |
| 01-16.txt | AC | 185 ms | 51452 KiB |
| 01-17.txt | AC | 185 ms | 51560 KiB |
| 01-18.txt | AC | 187 ms | 52904 KiB |
| 01-19.txt | AC | 188 ms | 54884 KiB |
| 01-20.txt | AC | 182 ms | 51292 KiB |
| 01-21.txt | AC | 180 ms | 51496 KiB |
| 01-22.txt | AC | 203 ms | 55120 KiB |
| 01-23.txt | AC | 178 ms | 51720 KiB |