QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#758730#6624. String ProblemLoxilante#WA 2ms3720kbC++201.6kb2024-11-17 19:30:262024-11-17 19:30:26

Judging History

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

  • [2024-11-17 19:30:26]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3720kb
  • [2024-11-17 19:30:26]
  • 提交

answer

#define F_C
#include <bits/stdc++.h>
#define rep(i, l, r) for(int i = l; i < r; i++)
#define hrp(i, l, r) for(int i = l; i <= r; i++)
#define rev(i, r, l) for(int i = r; i >= l; i--)
#define int ll
using namespace std;
typedef long long ll;
template<typename tn = int> tn next(void) { tn k; cin>>k; return k; }
#ifndef LOCAL
#define D(...) 0
#endif
signed main(void)
{
    #ifdef LOCAL
//	freopen("C:\\Users\\Loxil\\Desktop\\IN.txt", "r", stdin);
//	freopen("C:\\Users\\Loxil\\Desktop\\OUT.txt", "w", stdout);
    #endif
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string str; cin>>str;

    char maxx = -1;
    vector<pair<int, int>> v;
    bool sync = 0;
    rep(i, 0, str.size())
    {
        if (str[i] > maxx) maxx = str[i], v.clear(), v.push_back({i, 1}), sync = 0;
        else if (str[i] == maxx)
        {
            sync = 0;
            if (str[i-1] == maxx)
            {
                if (++v.back().second > v.begin()->second)
                {
                    auto sv = v.back();
                    v.clear();
                    v.push_back(sv);
                }
            }
            else v.push_back({i, 1});
        }
        else
        {
            if (str[i-1] == maxx && v.back().second == v.begin()->second) sync = 1;
            if (sync && str[i] > str[i-v.back().first+v.begin()->first])
            {
                auto sv = v.back();
                v.clear();
                v.push_back(sv);
            }
        }
        cout<<v.begin()->first+1<<' '<<i+1<<endl;
    }
    
    return 0;
}
/*
zbbbccc zbbbcbc zbbbccb zbbbccd zzbb zzbc zzzd
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 2ms
memory: 3720kb

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: 0ms
memory: 3608kb

input:

gtgggtgttgggggtgtgggtgttggtttggggtggtgtgggttggtggggtgggttgttggttgggtttggggtgttgggggtgggttttggttgttggtggggttgttggtggtggggtgggttttgggttggtgggtgggtggttgtgttggttttttttgttgggtttgggtgttgttgtggtgggttttggttggggtgttggttggtgtggtgtgggttttggttttttgtttgtggtggtgttttgtttttggtggggtgtttgttgttttggggttggggtgggggttgtgg...

output:

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

result:

wrong answer 15th words differ - expected: '6', found: '2'