#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;
for (int i = 0; i < n; ++i)
cin >> a[i];
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 (a[j].size()>=vf.size()+vs.size()) {
if (a[j].substr(0,vf.size())==vf && a[j].substr(a[j].size()-vs.size(),vs.size())==vs)
++ans;
}
}
cout << ans << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
177 ms |
7184 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1580 ms |
6560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |