CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:soap
Submission time:2017-10-02 01:56:16 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#20.04 sdetails
#30.04 sdetails
#40.05 sdetails
#50.05 sdetails
#60.04 sdetails
#70.05 sdetails
#80.05 sdetails
#90.04 sdetails
#100.04 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:8:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(i < inp.length()) 
                          ^

Code

#include <bits/stdc++.h>
#define REP(i,a,b) for (int i = a; i <= b; i++)
using namespace std;
int main() {
    string inp;
    cin >> inp;
    int i = 0;
    while(i < inp.length()) 
    {
    //cout << inp[i] << ", " << inp[i+1] << "\n";
    if(inp[i] == inp[i+1])
    {
            int x = i+2;
            while(x > 0)
            {
                if(inp[i] == inp[x]) x++;
             
                else 
        {
                    cout << i << "-" << x << "\n";
                    inp.erase(i, x-i);
                    x = -1;
                }
            }
    //cout << "reset \n";
        i = 0;
    }
    else i++;
    }
    cout << inp << "\n";
     
}

Test details

Test 1

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 2

Verdict:

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
0-2
0-2
0-2
0-2
0-2
...

Test 3

Verdict:

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
499-501
498-500
497-499
496-498
495-497
...

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
0-2
3-8
2-5
1-5
0-2
...

Test 5

Verdict:

input
ACDCBBACDBBBACAACBBDBADBAABABA...

correct output
ACDCACDADBADABACACDCADADABABCA...

user output
4-6
7-10
9-11
8-10
8-10
...

Test 6

Verdict:

input
EETFHIJOGACDHMGVFJCMETMZDEITTR...

correct output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

user output
0-2
25-27
55-57
71-73
85-87
...

Test 7

Verdict:

input
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB...

correct output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

user output
1-3
19-21
20-22
23-25
36-38
...

Test 8

Verdict:

input
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS...

correct output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

user output
9-11
19-21
26-28
53-55
64-66
...

Test 9

Verdict:

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
2-4
7-9
27-29
33-35
93-95
...

Test 10

Verdict:

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
36-38
88-90
90-92
172-174
173-175
...