# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
5224 | ainta | 생일수 II (GA4_birthday2) | C++98 | 128 ms | 10656 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.
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N_ 200010
long long po[N_ * 2], D1[N_], S[N_], po2[N_], D2[N_], Mod=19980305, Res, R1;
char p[N_];
void Do(long long Sum, int Len){
Res = (Res + D2[Len] + Sum * Sum % Mod * (po2[Len] - 1) % Mod + (Sum * S[Len] * 2) % Mod - Sum * D1[Len] * (8 + 3) % Mod + Mod) % Mod;
}
void Gap(){
int i, n = strlen(p);
Res = 0;
long long Sum = 0, tp;
for (i = 1; i < n; i++){
Res = (Res + D2[i] + D1[i] * D1[i+1] * 24) % Mod;
}
for (i = 0; i < n; i++){
Sum = (Sum + po[n - i - 1] * 3) % Mod;
if (p[i] == '3')continue;
Do(Sum, n - i - 1);
Res = (Res + Sum * 3 * D1[n - i - 1]) % Mod;
tp = (Sum + po[n - i - 1] * 2) % Mod;
Res = (Res + tp * 8 * D1[n - i - 1] + Sum * tp % Mod + D1[n - i - 1] * D1[n - i - 1] * 24) % Mod;
Sum = tp;
if (p[i] == '5')continue;
Do(Sum, n - i - 1);
Res = (Res + Sum * 3 * D1[n - i - 1]) % Mod;
tp = (Sum + po[n - i - 1] * 3) % Mod;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |