CSES - Datatähti 2018 peili - Results
Submission details
Task:Merkkijono
Sender:ankka22
Submission time:2017-10-02 20:50:30 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#20.20 sdetails
#3ACCEPTED0.05 sdetails
#40.05 sdetails
#50.04 sdetails
#6ACCEPTED0.05 sdetails
#7ACCEPTED0.04 sdetails
#8ACCEPTED0.04 sdetails
#90.04 sdetails
#10ACCEPTED0.06 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:10:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 1; i < s.size(); i++) {
                              ^
input/code.cpp:13:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int o = i; o < s.size(); o++) {
                                ^

Code

#include <iostream>
#include <string>
using namespace std;
string s;
bool ok;
int main() {
	cin >> s;
	while (1) {
		ok = true;
		for (int i = 1; i < s.size(); i++) {
			if (s.at(i) == s.at(i-1)) {
				ok = false;
				for (int o = i; o < s.size(); o++) {
					s.erase(s.begin() + i);
					if (s.size() == 1 || s.at(i) != s.at(i-1)) break;
				}
				s.erase(s.begin() + i-1);
			}	
		}
		if (ok) break;
	}
	cout << s << endl;
}	

Test details

Test 1

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 2

Verdict:

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
(empty)

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at

Test 3

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
(empty)

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
AB

Test 5

Verdict:

input
ACDCBBACDBBBACAACBBDBADBAABABA...

correct output
ACDCACDADBADABACACDCADADABABCA...

user output
ACDCACDADBADABACACDCADADABABCA...

Test 6

Verdict: ACCEPTED

input
EETFHIJOGACDHMGVFJCMETMZDEITTR...

correct output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

user output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

Test 7

Verdict: ACCEPTED

input
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB...

correct output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

user output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

Test 8

Verdict: ACCEPTED

input
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS...

correct output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

user output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

Test 9

Verdict:

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

Test 10

Verdict: ACCEPTED

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...