# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
257759 | updown1 | Mate (COCI18_mate) | C++14 | 2090 ms | 28432 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Code by @marlov
*/
#include <bits/stdc++.h>
using namespace std;
#define maxV 2005
#define MOD 1000000007
string s;
int Q;
long long pc[maxV][maxV];
long long dp[maxV][26];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>s;
cin>>Q;
//precomute pc[n][m] which is the nCm
for(int i=0;i<maxV;i++){
pc[i][0]=1;
for(int j=1;j<i;j++){
pc[i][j]=pc[i-1][j]+pc[i-1][j-1];
pc[i][j]%=MOD;
}
pc[i][i]=1;
}
for(int i=0;i<26;i++){
for(int j=s.length()-1;j>=0;j--){
if(s[j]=='a'+i){
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |