답안 #548608

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
548608 2022-04-13T23:14:20 Z colossal_pepe Selling RNA Strands (JOI16_selling_rna) C++17
10 / 100
1500 ms 4044 KB
#include <iostream>
#include <vector>
using namespace std;

int n, m;
vector<string> S;

int solve(string pref, string suf) {
    int ans = 0;
    for (int i = 0; i < n; i++) {
        string cur = S[i];
        if (cur.size() < pref.size() or cur.size() < suf.size()) continue;
        if (cur.substr(0, pref.size()) == pref and cur.substr(cur.size() - suf.size(), suf.size()) == suf) ans++;
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    S.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }
    while (m--) {
        string pref, suf;
        cin >> pref >> suf;
        cout << solve(pref, suf) << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 464 ms 3688 KB Output is correct
2 Execution timed out 1515 ms 4044 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1586 ms 2260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 464 ms 3688 KB Output is correct
9 Execution timed out 1515 ms 4044 KB Time limit exceeded
10 Halted 0 ms 0 KB -