# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
914281 | OAleksa | Selling RNA Strands (JOI16_selling_rna) | C++14 | 1552 ms | 10712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
//ako ovaj vaso daso misli da me pobedjuje.....
using namespace std;
#define int long long
#define f first
#define s second
const int N = 1e5 + 69;
const int p = 31;
const int mod = 1e9 + 7;
const int B = 750;
int trie[N][26], node, n, q;
string s[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while (tt--) {
cin >> n >> q;
for (int i = 1;i <= n;i++)
cin >> s[i];
while (q--) {
string p, q;
cin >> p >> q;
int sz1 = p.size();
int sz2 = q.size();
int ans = 0;
for (int i = 1;i <= n;i++) {
int ptr1 = 0, ptr2 = q.size() - 1;
for (int j = 0;j < s[i].size();j++) {
if (ptr1 < sz1 && s[i][j] == p[ptr1])
ptr1++;
else
break;
}
if (ptr1 == sz1) {
for (int j = s[i].size() - 1;j >= 0;j--) {
if (ptr2 >= 0 && s[i][j] == q[ptr2])
ptr2--;
else
break;
}
if (ptr2 == -1)
++ans;
}
}
cout << ans << '\n';
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |