# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83573 | 2018-11-09T11:41:30 Z | heon | Mate (COCI18_mate) | C++11 | 2000 ms | 2728 KB |
#include<bits/stdc++.h> using namespace std; const long long MOD = 1000000007; string s; int q,qnum; string qs; long long povrh(int a,int b){ long long rt = 1; long long lt = 1; for(int i = b; i > 0; i--){ rt *= a; rt %= MOD; lt *= i; lt %= MOD; a--; } long long sol = rt/lt; sol %= MOD; return sol; } int main(){ cin >> s >> q; for(int i = 0; i < q; i++){ cin >> qnum >> qs; long long sol = 0; for(int j = 0; j < s.size()-1; j++){ if(s[j] != qs[0]) continue; for(int k = j+1; k < s.size(); k++){ if(s[k] != qs[1]) continue; if(j >= qnum-2) sol += povrh(j,qnum-2); } } sol %= MOD; cout << sol << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 63 ms | 376 KB | Output isn't correct |
2 | Incorrect | 43 ms | 376 KB | Output isn't correct |
3 | Incorrect | 46 ms | 464 KB | Output isn't correct |
4 | Incorrect | 77 ms | 464 KB | Output isn't correct |
5 | Incorrect | 778 ms | 1388 KB | Output isn't correct |
6 | Incorrect | 841 ms | 2100 KB | Output isn't correct |
7 | Incorrect | 688 ms | 2360 KB | Output isn't correct |
8 | Incorrect | 646 ms | 2728 KB | Output isn't correct |
9 | Execution timed out | 2059 ms | 2728 KB | Time limit exceeded |
10 | Execution timed out | 2053 ms | 2728 KB | Time limit exceeded |