Task: | Merkkijono |
Sender: | Challe |
Submission time: | 2017-10-10 14:45:21 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | RUNTIME ERROR | 0.18 s | details |
#3 | WRONG ANSWER | 0.05 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
#5 | RUNTIME ERROR | 0.19 s | details |
#6 | ACCEPTED | 0.06 s | details |
#7 | WRONG ANSWER | 0.06 s | details |
#8 | ACCEPTED | 0.05 s | details |
#9 | ACCEPTED | 0.05 s | details |
#10 | WRONG ANSWER | 0.06 s | details |
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: RUNTIME ERROR
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: WRONG ANSWER
input |
---|
ABABABABABABABABABABABABABABAB... |
correct output |
---|
(empty) |
user output |
---|
ABABABABABABABABABABABABABABAB... |
Test 4
Verdict: WRONG ANSWER
input |
---|
BBABABBBBBAABBBABABABBBBAAABAB... |
correct output |
---|
BAB |
user output |
---|
ABAABABABABABABABBABBABABBBABB... |
Test 5
Verdict: RUNTIME ERROR
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: WRONG ANSWER
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: WRONG ANSWER
input |
---|
POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
correct output |
---|
POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
user output |
---|
POXHAHYEZTLYNFSLABODMRNKDSKROZ... |