# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
96758 | Rouge_Hugo | Mate (COCI18_mate) | C++14 | 2065 ms | 3332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mod =1e9+7;
int dp[2003][28][28];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie (NULL);
string s;cin>>s;
int n=s.size();
for(int i=0;i<n;i++)
{
for(int j=i+1;j>2;j--)
{
for(int u=1;u<=26;u++)
{
for(int h=1;h<27;h++)
{
dp[j][u][s[i]-'0'-48]+=dp[j-1][h][u]%mod;
dp[j][u][s[i]-'0'-48]%=mod;
}
}
}
for(int j=1;j<=26;j++)
{
dp[2][j][s[i]-'0'-48]+=dp[1][0][j];
dp[2][j][s[i]-'0'-48]%=mod;
}
dp[1][0][s[i]-'0'-48]++;
}
char c,c1;
int x;
int q;cin>>q;
while (q--)
{
cin>>x;
cin>>c>>c1;
cout<<dp[x][c-'0'-48][c1-'0'-48]%mod<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |