CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:SeveriK
Submission time:2017-10-03 17:46:27 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#20.06 sdetails
#30.05 sdetails
#4ACCEPTED0.06 sdetails
#50.04 sdetails
#6ACCEPTED0.04 sdetails
#7ACCEPTED0.06 sdetails
#8ACCEPTED0.05 sdetails
#9ACCEPTED0.06 sdetails
#10ACCEPTED0.05 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:98:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < input.length(); i++)
                                    ^

Code

/*
#include <iostream>
#include <string>

using namespace std;

int main()
{
	for (int i = 0; i < 10; i++)
	{
		string curRow = "";

		for (int o = 0; o < 10; o++)
		{
			int n = i + o;
			if (n > 9)
			{
				n -= 10;
			}
			curRow += to_string(n);

			n = o - i;
			if (n < 0)
			{
				n += 10;
			}

			if (n == 0)
			{
				curRow += "A ";
			}
			else if (n == 1)
			{
				curRow += "B ";
			}
			else if (n == 2)
			{
				curRow += "C ";
			}
			else if (n == 3)
			{
				curRow += "D ";
			}
			else if (n == 4)
			{
				curRow += "E ";
			}
			else if (n == 5)
			{
				curRow += "F ";
			}
			else if (n == 6)
			{
				curRow += "G ";
			}
			else if (n == 7)
			{
				curRow += "H ";
			}
			else if (n == 8)
			{
				curRow += "I ";
			}
			else if (n == 9)
			{
				curRow += "J ";
			}
		}

		cout << curRow << "\n";
	}

	int a;
	cin >> a;

	return 0;
}*/
//Tehtävä 5

#include <iostream>
#include <string>

using namespace std;

int main()
{
	string input = "";
	cin >> input;

	bool modifyDone = false, modified = false, deleteNext = false;
	string output = "";
	char lastChar = ' ';
	while (!modifyDone)
	{
		output = "";
		deleteNext = false;
		modified = false;
		for (int i = 0; i < input.length(); i++)
		{
			if (i != 0) {
				if (input[i] == lastChar && (deleteNext || !modified))
				{
					output.pop_back();
					deleteNext = true;
					modified = true;
				}
				else if (deleteNext)
				{
					output.pop_back();
					deleteNext = false;
					modified = true;
				}
			}
			output += input[i];
			lastChar = input[i];
		}
		if (!modified)
		{
			modifyDone = true;
		}
		else
		{
			input = output;
		}
	}

	cout << output << "\n";

	int a;
	cin >> a;

	return 0;
}
//Tehtävä 1

Test details

Test 1

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 2

Verdict:

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
B

Test 3

Verdict:

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
A

Test 4

Verdict: ACCEPTED

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
BAB

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: ACCEPTED

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

Test 10

Verdict: ACCEPTED

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...