提出 #74667036
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
b[i]--;
}
int m;
cin >> m;
vector<string> s(m);
for (int i = 0; i < m; i++) {
cin >> s[i];
}
bool ok[11][10][26] = {false};
for (string& str : s) {
int len = str.size();
for (int pos = 0; pos < len; pos++) {
int ch = str[pos] - 'a';
ok[len][pos][ch] = true;
}
}
for (string& spine : s) {
if ((int)spine.size() != n) {
cout << "No\n";
continue;
}
bool possible = true;
for (int i = 0; i < n; i++) {
int needLen = a[i];
int needPos = b[i];
int needChar = spine[i] - 'a';
if (!ok[needLen][needPos][needChar]) {
possible = false;
break;
}
}
cout << (possible ? "Yes" : "No") << "\n";
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Fishbones |
| ユーザ | Dfsaot |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 300 |
| コード長 | 1088 Byte |
| 結果 | AC |
| 実行時間 | 45 ms |
| メモリ | 9624 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 | 1 ms | 3612 KiB |
| 00-sample-02.txt | AC | 1 ms | 3568 KiB |
| 01-01.txt | AC | 5 ms | 4100 KiB |
| 01-02.txt | AC | 18 ms | 6808 KiB |
| 01-03.txt | AC | 32 ms | 9496 KiB |
| 01-04.txt | AC | 19 ms | 6916 KiB |
| 01-05.txt | AC | 25 ms | 7868 KiB |
| 01-06.txt | AC | 21 ms | 7124 KiB |
| 01-07.txt | AC | 39 ms | 9532 KiB |
| 01-08.txt | AC | 43 ms | 9476 KiB |
| 01-09.txt | AC | 5 ms | 4172 KiB |
| 01-10.txt | AC | 19 ms | 6716 KiB |
| 01-11.txt | AC | 5 ms | 4048 KiB |
| 01-12.txt | AC | 31 ms | 8792 KiB |
| 01-13.txt | AC | 22 ms | 7228 KiB |
| 01-14.txt | AC | 18 ms | 6532 KiB |
| 01-15.txt | AC | 40 ms | 9548 KiB |
| 01-16.txt | AC | 44 ms | 9560 KiB |
| 01-17.txt | AC | 43 ms | 9604 KiB |
| 01-18.txt | AC | 45 ms | 9608 KiB |
| 01-19.txt | AC | 43 ms | 9624 KiB |
| 01-20.txt | AC | 43 ms | 9532 KiB |
| 01-21.txt | AC | 43 ms | 9372 KiB |
| 01-22.txt | AC | 43 ms | 9560 KiB |
| 01-23.txt | AC | 44 ms | 9624 KiB |