# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
548662 | SlyGaleeb | Selling RNA Strands (JOI16_selling_rna) | C++17 | 1111 ms | 1048576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ld long double
#define vf v[i].first
#define vs v[i].second
void print(vector<int> &v) {
for (auto c:v)
cout << c << " ";
cout << "\n";
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin >> n >> m;
vector<string>a(n);
vector<pair<string,string>>v;
set<string>pre[5005],suf[5005];
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 0; i < n; ++i) {
string t1,t2;
int j = 0,k = a[i].size()-1;
while (j<a[i].size() && k>=0) {
t1.push_back(a[i][j]);
t2.insert(0,1,a[i][k]);
pre[i].insert(t1);
suf[i].insert(t2);
j++,k--;
}
t1.clear();
t2.clear();
}
for (int i = 0; i < m; ++i) {
string p,q;
cin >> p >> q;
v.push_back({p,q});
}
for (int i = 0; i < m; ++i) {
int ans = 0;
for (int j = 0; j < n; ++j) {
if (pre[j].count(vf) && suf[j].count(vs))
++ans;
}
cout << ans << "\n";
}
}
컴파일 시 표준 에러 (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... |