CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:Challe
Submission time:2017-10-10 14:45:21 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#20.18 sdetails
#30.05 sdetails
#40.06 sdetails
#50.19 sdetails
#6ACCEPTED0.06 sdetails
#70.06 sdetails
#8ACCEPTED0.05 sdetails
#9ACCEPTED0.05 sdetails
#100.06 sdetails

Compiler report

input/code.cpp: In function 'std::string Funktio(std::string)':
input/code.cpp:17:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (num < mjono.length()) {
                            ^
input/code.cpp:18:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (num + 1 == mjono.length()) {
                               ^
input/code.cpp:14:6: warning: unused variable 'num2' [-Wunused-variable]
  int num2 = 1;
      ^

Code

// ConsoleApplication7.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <vector>
#include <string>
#include <iostream>

using namespace std;

string Funktio(string mjono) 
{
	int num = 0;
	int num2 = 1;
	int  count = 1;
	char kirj;
	while (num < mjono.length()) {
		if (num + 1 == mjono.length()) {
			break;
		}
		if(mjono.at(num) == mjono.at(num+1)){
			kirj = mjono.at(num);
			while (kirj == mjono.at(num + count)) {
				count++;
			}
			mjono.erase(num, count);
			count = 1;
		}
		else {
			num++;
		}
	}
	return mjono;
}

int main()
{
	string a = "";
	cin >> a;
	cout << Funktio(a);
	cin >> a;
    return 0;
}

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:

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
ABABABABABABABABABABABABABABAB...

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
ABAABABABABABABABBABBABABBBABB...

Test 5

Verdict:

input
ACDCBBACDBBBACAACBBDBADBAABABA...

correct output
ACDCACDADBADABACACDCADADABABCA...

user output
(empty)

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

Test 6

Verdict: ACCEPTED

input
EETFHIJOGACDHMGVFJCMETMZDEITTR...

correct output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

user output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

Test 7

Verdict:

input
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB...

correct output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

user output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

Test 8

Verdict: ACCEPTED

input
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS...

correct output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

user output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

Test 9

Verdict: ACCEPTED

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

Test 10

Verdict:

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...