QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#773176#6624. String ProblemPoonYaPatWA 1ms3576kbC++14613b2024-11-23 02:59:142024-11-23 02:59:15

Judging History

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

  • [2024-11-23 02:59:15]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3576kb
  • [2024-11-23 02:59:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s; cin>>s; s=" "+s;

    int sz,lpos=1,rpos=1;
    cout<<"1 1\n";

    for (int i=2; i<(int)(s.size()); ++i) {
        if (s[i]>s[lpos]) lpos=rpos=i;
        else if (lpos!=rpos) {
            int x=lpos+(i-lpos)%sz;
            if (s[x]>s[i]) rpos=lpos;
            else if (s[x]<s[i]) lpos=rpos;
            else if ((i-lpos)%sz==0) rpos=i;
        } else if (s[i]==s[lpos]) {
            rpos=i;
            sz=i-lpos;
        }
        cout<<lpos<<" "<<i<<"\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

potato

output:

1 1
1 2
3 3
3 4
3 5
5 6

result:

ok 12 tokens

Test #2:

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

input:

pbpbppb

output:

1 1
1 2
1 3
1 4
1 5
5 6
5 7

result:

ok 14 tokens

Test #3:

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

input:

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62...

result:

ok 1990 tokens

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3516kb

input:

gtgggtgttgggggtgtgggtgttggtttggggtggtgtgggttggtggggtgggttgttggttgggtttggggtgttgggggtgggttttggttgttggtggggttgttggtggtggggtgggttttgggttggtgggtgggtggttgtgttggttttttttgttgggtttgggtgttgttgtggtgggttttggttggggtgttggttggtgtggtgtgggttttggttttttgtttgtggtggtgttttgtttttggtggggtgtttgttgttttggggttggggtgggggttgtgg...

output:

1 1
2 2
2 3
2 4
2 5
2 6
2 7
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
6 16
6 17
6 18
6 19
6 20
6 21
6 22
6 23
6 24
6 25
6 26
21 27
21 28
28 29
28 30
28 31
28 32
28 33
28 34
28 35
28 36
28 37
28 38
28 39
28 40
28 41
28 42
28 43
28 44
28 45
28 46
43 47
43 48
43 49
43 50
43 51
43 52
43 53
43 54
43 55
43 56...

result:

wrong answer 17th words differ - expected: '8', found: '6'