Submission #2431

# Submission time Handle Problem Language Result Execution time Memory
2431 2013-07-21T10:40:10 Z pl0892029 생일수 II (GA4_birthday2) C++
25 / 100
67 ms 40340 KB
#include <cstdio>

char st[200001], ed[200001];
int bn[10000001], front, rear;
int mod=19980305;

int main() {
    int sp=0, se=0, ep=0, ee=0;
    gets(st); gets(ed);
    
    front = rear = 0;
    bn[rear++]=0;
    
    bool secheck, eecheck;
    
    while(st[sp] || ed[ep]) {
        secheck=false;
        eecheck=false;
        
        if( front==se ) secheck=true;
        if( front==ee ) eecheck=true;
        
        int temp = bn[front++];
        if( secheck && st[sp]=='3' ) {
            sp++;
            se = rear;
            secheck = false;
        }
        if( eecheck && ed[ep]=='3' ) {
            ep++;
            ee = rear;
            eecheck = false;
        }
        bn[rear++] = (10*temp+3)%mod;
        if( secheck && st[sp]=='5' ) {
            sp++;
            se = rear;
            secheck = false;
        }
        if( eecheck && ed[ep]=='5' ) {
            ep++;
            ee = rear;
            eecheck = false;
        }
        bn[rear++] = (10*temp+5)%mod;
        if( secheck && st[sp]=='8' ) {
            sp++;
            se = rear;
            secheck = false;
        }
        if( eecheck && ed[ep]=='8' ) {
            ep++;
            ee = rear;
            eecheck = false;
        }
        bn[rear++] = (10*temp+8)%mod;
    }
    int ans = 0;
    for(int i=se;i<ee;i++) {
        ans += (int)((long long)bn[i]*bn[i+1]%mod);
        ans %= mod;
    }
    printf("%d",ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40340 KB Output is correct
2 Correct 0 ms 40340 KB Output is correct
3 Correct 0 ms 40340 KB Output is correct
4 Correct 0 ms 40340 KB Output is correct
5 Correct 0 ms 40340 KB Output is correct
6 Correct 0 ms 40340 KB Output is correct
7 Correct 0 ms 40340 KB Output is correct
8 Correct 0 ms 40340 KB Output is correct
9 Correct 0 ms 40340 KB Output is correct
10 Correct 0 ms 40340 KB Output is correct
11 Correct 0 ms 40340 KB Output is correct
12 Correct 0 ms 40340 KB Output is correct
13 Correct 0 ms 40340 KB Output is correct
14 Correct 0 ms 40340 KB Output is correct
15 Correct 0 ms 40340 KB Output is correct
16 Correct 0 ms 40340 KB Output is correct
17 Correct 0 ms 40340 KB Output is correct
18 Correct 0 ms 40340 KB Output is correct
19 Correct 0 ms 40340 KB Output is correct
20 Correct 0 ms 40340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40340 KB Output is correct
2 Correct 1 ms 40340 KB Output is correct
3 Correct 0 ms 40340 KB Output is correct
4 Correct 0 ms 40340 KB Output is correct
5 Correct 0 ms 40340 KB Output is correct
6 Correct 0 ms 40340 KB Output is correct
7 Correct 0 ms 40340 KB Output is correct
8 Correct 1 ms 40340 KB Output is correct
9 Correct 0 ms 40340 KB Output is correct
10 Correct 0 ms 40340 KB Output is correct
11 Correct 1 ms 40340 KB Output is correct
12 Correct 1 ms 40340 KB Output is correct
13 Correct 0 ms 40340 KB Output is correct
14 Correct 0 ms 40340 KB Output is correct
15 Correct 0 ms 40340 KB Output is correct
16 Correct 1 ms 40340 KB Output is correct
17 Correct 0 ms 40340 KB Output is correct
18 Correct 0 ms 40340 KB Output is correct
19 Correct 0 ms 40340 KB Output is correct
20 Correct 0 ms 40340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 66 ms 40336 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 67 ms 40336 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 65 ms 40336 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -