# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143649 | vladciuperceanu | Mate (COCI18_mate) | C++14 | 2069 ms | 57608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;
long long Q,d,i,j,comb[2005][2005],D[2005][30][30];
long long r[2005][30],poz[30][2005],sol[2005][30][30];
char s[2005],x,y;
int main()
{
cin >> (s+1);
int n = strlen((s+1));
comb[0][0] = 1;
for (i=1; i<=n; i++)
{
comb[i][0] = comb[i][i] = 1;
for (j=1; j<i; j++)
comb[i][j] = (comb[i-1][j-1]+comb[i-1][j])%MOD;
}
for (i=1; i<=n; i++)
poz[s[i]-'a'][++poz[s[i]-'a'][0]] = i;
for (i=n; i>=1; i--)
for (j=0; j<26; j++)
if (s[i] == 'a'+j)
r[i][j] = 1+r[i+1][j];
else
r[i][j] = r[i+1][j];
for (i=n; i>=1; i--)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |