# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
365418 | BartolM | Selling RNA Strands (JOI16_selling_rna) | C++17 | 2 ms | 1132 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;
typedef pair <ll, ll> pll;
typedef pair <pii, pii> ppp;
const int INF=0x3f3f3f3f;
const int N=105;
const int MAX=2e6+5;
int n, q, len;
char inp[N];
string str;
string s[N];
int cnt[N];
void solve() {
for (int i=0; i<q; ++i) {
memset(cnt, 0, sizeof cnt);
scanf("%s", inp);
str=inp;
for (int j=0; j<n; ++j) {
if (str.size()>s[j].size()) continue;
if (s[j].substr(0, str.size())==str) ++cnt[j];
}
scanf("%s", inp);
str=inp;
int res=0;
for (int j=0; j<n; ++j) {
if (str.size()>s[j].size()) continue;
if (s[j].substr((int)s[j].size()-(int)str.size(), str.size())==str) ++cnt[j];
if (cnt[j]==2) ++res;
}
printf("%d\n", res);
}
}
void load() {
scanf("%d %d", &n, &q);
for (int i=0; i<n; ++i) {
scanf("%s", inp);
s[i]=inp;
}
}
int main() {
load();
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... |