# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1079093 | boris_mihov | Selling RNA Strands (JOI16_selling_rna) | C++17 | 1572 ms | 8528 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <map>
typedef long long llong;
const int MAXN = 100000 + 10;
const int MOD1 = 1000003013;
const int MOD2 = 1000003241;
const int BASE = 5;
int n, q;
std::string s[MAXN];
void solve()
{
for (int i = 1 ; i <= q ; ++i)
{
std::string x, y;
std::cin >> x >> y;
std::reverse(y.begin(), y.end());
int cnt = 0;
for (int j = 1 ; j <= n ; ++j)
{
if (x.size() > s[j].size() || y.size() > s[j].size())
{
continue;
}
bool ok = true;
for (int k = 0 ; k < x.size() && ok ; ++k)
{
if (x[k] != s[j][k])
{
ok = false;
break;
}
}
std::reverse(s[j].begin(), s[j].end());
for (int k = 0 ; k < y.size() && ok ; ++k)
{
if (y[k] != s[j][k])
{
ok = false;
break;
}
}
std::reverse(s[j].begin(), s[j].end());
cnt += ok;
}
std::cout << cnt << '\n';
}
}
void input()
{
std::cin >> n >> q;
for (int i = 1 ; i <= n ; ++i)
{
std::cin >> s[i];
}
}
void fastIOI()
{
std::ios_base :: sync_with_stdio(0);
std::cout.tie(nullptr);
std::cin.tie(nullptr);
}
int main()
{
fastIOI();
input();
solve();
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... |