# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
365418 | 2021-02-11T15:53:39 Z | BartolM | Selling RNA Strands (JOI16_selling_rna) | C++17 | 2 ms | 1132 KB |
#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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1132 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 492 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Runtime error | 2 ms | 1132 KB | Execution killed with signal 11 |
9 | Halted | 0 ms | 0 KB | - |