#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()>=max(vf.size(),vs.size()) && a[j].substr(0,vf.size())==vf && a[j].substr(a[j].size()-vs.size(),vs.size())==vs)
++ans;
}
cout << ans << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
188 ms |
4640 KB |
Output is correct |
2 |
Correct |
771 ms |
7600 KB |
Output is correct |
3 |
Correct |
238 ms |
6700 KB |
Output is correct |
4 |
Correct |
302 ms |
6736 KB |
Output is correct |
5 |
Correct |
633 ms |
5292 KB |
Output is correct |
6 |
Correct |
660 ms |
5268 KB |
Output is correct |
7 |
Correct |
648 ms |
8136 KB |
Output is correct |
8 |
Correct |
1479 ms |
8744 KB |
Output is correct |
9 |
Correct |
1220 ms |
8740 KB |
Output is correct |
10 |
Execution timed out |
1570 ms |
6256 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1573 ms |
6092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
188 ms |
4640 KB |
Output is correct |
9 |
Correct |
771 ms |
7600 KB |
Output is correct |
10 |
Correct |
238 ms |
6700 KB |
Output is correct |
11 |
Correct |
302 ms |
6736 KB |
Output is correct |
12 |
Correct |
633 ms |
5292 KB |
Output is correct |
13 |
Correct |
660 ms |
5268 KB |
Output is correct |
14 |
Correct |
648 ms |
8136 KB |
Output is correct |
15 |
Correct |
1479 ms |
8744 KB |
Output is correct |
16 |
Correct |
1220 ms |
8740 KB |
Output is correct |
17 |
Execution timed out |
1570 ms |
6256 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |