General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
10746306 Practice:
aka.Sohieb
535D - 24 GNU C++11 Accepted 1793 ms 11744 KB 2015-04-17 00:43:56 2015-04-17 00:43:56
 
 
→ Source
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(void)
{
    int n, m;
    string str;
    cin >> n >> m >> str;
    vector<int> v(m), dp(n+m);
    for (int i = 0; i < m; ++i)
    {
        cin >> v[i];
        dp[v[i] - 1] += 1;
        dp[v[i] - 1 + str.size()] -= 1;
        if (!i)
            continue;
        int d = v[i] - v[i - 1];
        if (d < str.size() && str[0] != str[d])
        {
            cout << 0 << endl;
            return 0;
        }       
    }   
    long long ret = 1, mod = 1000000007;
    for (int i = 0; i < n; ++i)
    {
        if (i)
            dp[i] += dp[i - 1];
        int val = dp[i] > 0 ? 1 : 26;
        ret = (ret * val) % mod;
    }
    cout << ret << endl;
    return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details