QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#324683#7955. Tandem CopyDelay_for_five_minutesWA 0ms3704kbC++202.9kb2024-02-10 23:02:542024-02-10 23:02:54

Judging History

你现在查看的是最新测评结果

  • [2024-02-10 23:02:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-02-10 23:02:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
string s , t ,t2;
int r[20005];
void work(int n) {
    int mn = n ;
    int ans = 0;
    for(int i = n - 1;i >= 0;i--) {
        mn = min(mn , r[i]) ;
        ans += (n - mn) ;
    }
    cout << ans << '\n' ;
    return ;
}
int main() {
    ios::sync_with_stdio(false) ; cin.tie(0) ;
    cin >> s >> t2;
    for(int i = 0;i < t2.size();i++) {
        if(i == 0 || t2[i] != t2[i - 1]) t += t2[i] ;
    }
    if(t.size() == 1) {
        for(int i = 0;i < s.size();i++) {
            if(s[i] == t[0]) r[i] = i;
            else r[i] = 1e9;
        }
        work(s.size()) ;
        return 0;
    }
    for(int i = 0;i < s.size();i++) r[i] = 1e9;
    for(int i = 0;i < (int)s.size() - 1;i++) {
        int curt = 0 , curs = i;
        while(curt < t.size()) {
            if(s[curs] != t[curt] || s[curs + 1] != t[curt + 1]) {r[i] = 1e9 ; break ;}
            int cs = 0 , ct = 0;
            while(curs + 1 < s.size() && curt + 1 < t.size() && s[curs] == t[curt] && s[curs + 1] == t[curt + 1]) {
                curt += 2; ct += 2;
            }
            ///[i,curs + 1] -> [0 , curt - 1]
            if(curt == t.size()) {r[i] = curs + 1; break;}
            // printf("CT %d\n",curt) ;
            if(curt == t.size() - 1) {
                if(s[curs] == t[curt]) {r[i] = curs + 1; break ;}
            }
            while(curs + 3 < s.size() && s[curs] == s[curs + 2] && s[curs + 1] == s[curs + 3]) {
                curs += 2 ; cs += 2;
            }
            if(cs > ct) break ;
            curs++; curt--;
            // printf("%d %d %d\n",i,curs,curt) ;
            if(curs == s.size() - 1) {
                r[i] = 1e9 ; break ;
            }
        }
        curt = 0 ; curs = i - 1;
        while(curt < t.size()) {
            char scurs , scurs1 ;
            if(curs == i - 1) scurs = s[i + 1];
            else scurs = s[i] ;
            scurs1 = s[curs + 1] ;

            if(scurs != t[curt] || scurs1 != t[curt + 1]) {break ;}
            int cs = 0 , ct = 0;
            while(curs + 1 < s.size() && curt + 1 < t.size() && scurs == t[curt] && scurs1 == t[curt + 1]) {
                curt += 2; ct += 2;
            }
            ///[i,curs + 1] -> [0 , curt - 1]
            if(curt == t.size()) {r[i] = min(r[i] , curs + 1); break;}
            if(curt == t.size() - 1) {
                if(scurs == t[curt]) {r[i] = min(r[i] , curs + 1); break ;}
            }
            while(curs + 3 < s.size() && scurs == s[curs + 2] && scurs1 == s[curs + 3]) {
                curs += 2 ; cs += 2;
                scurs = s[curs];
                scurs1 = s[curs + 1];
            }
            if(cs > ct) break ;
            curs++; curt--;
            if(curs == s.size() - 1) {
                break ;
            }
        }
        r[i] = max(r[i] , i + 1) ;
        // printf("%d %d\n",i,r[i]) ;
    }
    work(s.size()) ;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

ACGCG
CCG

output:

9

result:

ok single line: '9'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

TATCGC
TTCCG

output:

6

result:

ok single line: '6'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

ABCABC
ABC

output:

7

result:

ok single line: '7'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

ABCABC
ABCABC

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

FUSBX
UUUUUUUUUU

output:

8

result:

ok single line: '8'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

IWN
NNNNNNNNNN

output:

3

result:

ok single line: '3'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

RMRMRMRMRMRMRMRMRMRMR
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMR

output:

210

result:

ok single line: '210'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

TY
YT

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

WZ
ZW

output:

1

result:

ok single line: '1'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

SBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBWGVXPWAXMSBSB
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...

output:

1121

result:

ok single line: '1121'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

TGJPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

897

result:

ok single line: '897'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

MKZOLDYLGAULULULUGASEAOZVIHNMRGKZQEIQYTGEMLBMAULULULULULULULPNERGKYZARPULULULULULAOZLQGYHULULULULZKYZUXEBVXZBULULULULULULULULULULULULULULULULDCEXCSTHQRULULULULULULULULULULULULULULULULULRDMPBDULULULUFVXWEMTULULULULULULULULULULULULULULULULULULULULCLULULULULULULULULULULULULULULULULULULULULULULULULULULU...

output:

46504613

result:

ok single line: '46504613'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

VEPZEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEMEM...

output:

43715406

result:

ok single line: '43715406'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

HKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKFBIAHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKIHKHKHKHKHKHKHKHKHKHKHKBHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHKHK...

output:

45393402

result:

ok single line: '45393402'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

ZHJDKBQNJPACACACACACACACACACACACACACACACACACACACACACACACEZACACACACACACACBLCRDQEACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACGUEKSAJOFACACACACACACACACACACACACACACACACACACACACACACKHUIOCNKXMKUOKACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACRACACACACACACACACACA...

output:

45452856

result:

ok single line: '45452856'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

CXQKRAVWKJFOHVJVMNSBGOEJZFAESPYDZCLUOHLBQEHIDLWQWQWQWQWQWQWQRETGMKPFZQWQWQWQWQWQWQWQWQWQWQWQWQWQWQWQSWLXQVWQWQWQWQWQWQWQWQVEHITSVRXBHEWCARSTKQZERXDNJTXGIHTBMCVYSKPSFYIDRGAIEVSTJGUBGMSQFXGWQFHBCTMGOWQWQWQWQWQWQWQPEYDLNUGDIOEKHRNSROPWQWQWQWQWQWQWQWQWQCMSPXODTIKOZYPFHROYFECRUJDWQWQWQWQWQWQWQWQWQWQJUWJK...

output:

49328004

result:

ok single line: '49328004'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3704kb

input:

CBFKLKDEFBGHCEAMJIKGMLJFDKFIDJAKIADCHEJAMJBIFBJCEJCKDFLAFMEGDAMHLDCFGDBJDKLGIDCBMAFBMLFDJGAMLEAHBCIDLFJKCGHILCEDBLKIDMJDICBMFKLDKGLKMLFGKIDGHJIKJHBAJFMLJMEHGFEGAHBJLEBHKAJCKADEFGIEMGKCGMBEJKCFGAIMJBDGFHEMAELCDHCFJGAKEBJFHBDMKEMCJIKLGMCFJGDFLBACHECJMECIDGBKJHMEHILCKIBCLIFMHJFDGAILEBGIAJIFCILFJBLFALGB...

output:

0

result:

ok single line: '0'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

JIDABCASN
ABCBABCBC

output:

0

result:

ok single line: '0'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

ASFJABCSFN
ABCABC

output:

0

result:

ok single line: '0'

Test #20:

score: -100
Wrong Answer
time: 0ms
memory: 3568kb

input:

ELUNVXDGQHAYMVWAYBQUJIMOFNOVPTALPHTWCPDMALKAZEAPXFMZCTLKHFIYPUOYKIVLNGHTXSJNIHZURWNYNXBMWOVZYXAQDKFWTHCYVQNFMNIQRFWKTQYHAVJOXNMPTIRWLJXERAWFSZKVOWTNXOTXSTWIGNCEKWDEADLSWHCQDPECUXEKAFEHPKHLTHPFYLUBXGMKENZTOQZKAESFNIQAKUVWPNQAPEHAVIWFAOIXMBPJITYOLTKYGAWKBDOZJUFOVCPGDFZLFQIGEBDEMNUPYEKWSCGDOUWEOJXMAHGZ...

output:

411897

result:

wrong answer 1st lines differ - expected: '0', found: '411897'