Submission #74666481
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<char, int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define rev(a) (a).rbegin(), (a).rend()
#define pb push_back
#define eb emplace_back
#define pob pop_back
int main() {
int n, m;
cin >> n;
vector<int> a(n), b(n);
rep(i,n) cin >> a[i] >> b[i];
cin >> m;
vector<set<P>> st(11);
vector<string> s(m);
rep(i,m) {
cin >> s[i];
int l = s[i].size();
rep(j,l) st[l].insert(P(s[i][j],j));
}
rep(i,m) {
string t = s[i];
int l = t.size();
if(l != n) {
cout << "No\n";
continue;
}
bool ok = true;
rep(j,l) if(!st[a[j]].count(P(t[j],b[j]-1))) ok = false;
cout << (ok ? "Yes\n" : "No\n");
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Fishbones |
| User | WebP |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 926 Byte |
| Status | AC |
| Exec Time | 193 ms |
| Memory | 9652 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3536 KiB |
| 00-sample-02.txt | AC | 1 ms | 3600 KiB |
| 01-01.txt | AC | 15 ms | 4164 KiB |
| 01-02.txt | AC | 58 ms | 6824 KiB |
| 01-03.txt | AC | 103 ms | 9412 KiB |
| 01-04.txt | AC | 61 ms | 6820 KiB |
| 01-05.txt | AC | 85 ms | 8004 KiB |
| 01-06.txt | AC | 74 ms | 7356 KiB |
| 01-07.txt | AC | 171 ms | 9412 KiB |
| 01-08.txt | AC | 193 ms | 9548 KiB |
| 01-09.txt | AC | 13 ms | 4276 KiB |
| 01-10.txt | AC | 54 ms | 6732 KiB |
| 01-11.txt | AC | 13 ms | 4276 KiB |
| 01-12.txt | AC | 89 ms | 8772 KiB |
| 01-13.txt | AC | 62 ms | 7204 KiB |
| 01-14.txt | AC | 52 ms | 6588 KiB |
| 01-15.txt | AC | 130 ms | 9652 KiB |
| 01-16.txt | AC | 147 ms | 9520 KiB |
| 01-17.txt | AC | 97 ms | 9512 KiB |
| 01-18.txt | AC | 98 ms | 9532 KiB |
| 01-19.txt | AC | 96 ms | 9456 KiB |
| 01-20.txt | AC | 98 ms | 9512 KiB |
| 01-21.txt | AC | 97 ms | 9532 KiB |
| 01-22.txt | AC | 100 ms | 9528 KiB |
| 01-23.txt | AC | 104 ms | 9512 KiB |