| Task: | Merkkijono |
| Sender: | ISIMO66 |
| Submission time: | 2017-10-03 22:42:17 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.20 s | details |
| #2 | RUNTIME ERROR | 0.19 s | details |
| #3 | RUNTIME ERROR | 0.20 s | details |
| #4 | RUNTIME ERROR | 0.19 s | details |
| #5 | RUNTIME ERROR | 0.20 s | details |
| #6 | RUNTIME ERROR | 0.18 s | details |
| #7 | RUNTIME ERROR | 0.19 s | details |
| #8 | RUNTIME ERROR | 0.18 s | details |
| #9 | RUNTIME ERROR | 0.17 s | details |
| #10 | RUNTIME ERROR | 0.20 s | details |
Compiler report
input/code.cpp: In function 'int parse(char*, char*)':
input/code.cpp:61:25: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
while (index[i+ii] = 0){
^
input/code.cpp:77:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (ii = i){
^
input/code.cpp:131:26: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
while (index[i-ii] = 0){
^
input/code.cpp:132:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (ii = i){
^Code
#include "stdio.h"
#include "stdlib.h"
int parse( char *, char *);
int main ( int argc, char ** argv ){
//Get String
char * str = (char *)malloc(sizeof(char));
int i = 0;
str[0] = getchar();
while (1) {
if (str[i]== EOF){
str[i] = '\0';
break;
}
i++;
str = (char *)realloc(str, (i+2)*sizeof(char));
str[i] = getchar();
}
char * index = (char *)malloc(sizeof(str));
int j = 0;
while(str[j]){
index[j] = 1;
j++;
}
index[j] = '\0';
//Parse String
while(parse(str, index)) continue;
//Print String
j = 0;
while(str[j]){
if (index[j]){
putchar(str[j]);
}
j++;
}
putchar('\n');
free(str);
free(index);
return 0;
}
int parse(char * str, char * index) {
int i = 0;
int j = 0;
while (str[i]) {
if (!index[i]) {
i++;
continue;
}
if (!index[i+1] && !index[i-1]) {
//BOTH SIDES 0
//Check + side
int ii = 1;
while (index[i+ii] = 0){
if (str[i] == str[ii]){
index[i] = 0;
j++;
break;
}
ii++;
}
if (str[i] == str[i+ii]){
index[i] = 0;
index[i+ii] = 0;
j++;
}
//Check - side
ii = 1;
while (index[i-ii] == 0){
if (ii = i){
break;
}
if (str[i] == str[ii]){
index[i] = 0;
j++;
break;
}
ii++;
}
if (str[i] == str[i-ii]){
index[i] = 0;
index[i-ii] = 0;
j++;
}
}
else if (!index[i+1]) {
// + SIDE 0
//Check - side
if (str[i] == str[i-1]){
index[i] = 0;
index[i-1] = 0;
j++;
}
//Check + side
else{
int ii = 1;
while (index[i+ii] == 0){
if (str[i] == str[ii]){
index[i] = 0;
j++;
break;
}
ii++;
}
if (str[i] == str[i+ii]){
index[i] = 0;
index[i+ii] = 0;
j++;
}
}
}
else if (!index[i-1]) {
// - SIDE 0
//check + side
if (str[i] == str[i+1]){
index[i] = 0;
index[i+1] = 0;
j++;
}
//Check - side
else{
int ii = 1;
while (index[i-ii] = 0){
if (ii = i){
break;
}
if (str[i] == str[ii]){
index[i] = 0;
j++;
break;
}
ii++;
}
if (str[i] == str[i-ii]){
index[i] = 0;
index[i-ii] = 0;
j++;
}
}
}
else {
//BOTH SIDES 1
if (str[i] == str[i+1]) {
index[i] = 0;
index[i+1] = 0;
j++;
}
if (str[i] == str[i-1]) {
index[i] = 0;
index[i-1] = 0;
j++;
}
}
i++;
}
if (j > 0) return 1;
return 0;
}
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| ABABABABABABABABABABABABABABAB... |
| correct output |
|---|
| ABABABABABABABABABABABABABABAB... |
| user output |
|---|
| (empty) |
Error:
*** Error in `input/code': corrupted size vs. prev_size: 0x0000000001fd3400 ***
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| AABBAABBAABBAABBAABBAABBAABBAA... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Error:
*** Error in `input/code': corrupted size vs. prev_size: 0x000000000237d400 ***
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| ABABABABABABABABABABABABABABAB... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Error:
*** Error in `input/code': corrupted size vs. prev_size: 0x0000000001bfb400 ***
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| BBABABBBBBAABBBABABABBBBAAABAB... |
| correct output |
|---|
| BAB |
| user output |
|---|
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
Error:
*** Error in `input/code': corrupted size vs. prev_size: 0x0000000001e9b400 ***
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| ACDCBBACDBBBACAACBBDBADBAABABA... |
| correct output |
|---|
| ACDCACDADBADABACACDCADADABABCA... |
| user output |
|---|
| CCDBACACADADABABCACBCBCBCABABD... |
Error:
*** Error in `input/code': corrupted size vs. prev_size: 0x00000000024eb400 ***
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| EETFHIJOGACDHMGVFJCMETMZDEITTR... |
| correct output |
|---|
| TFHIJOGACDHMGVFJCMETMZDEIROTET... |
| user output |
|---|
| TFHIJOGACDHMGVFJCMETMZDEIROTET... |
Error:
*** Error in `input/code': free(): invalid next size (fast): 0x0000000000731410 ***
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| GOONLAHLYPRFCZKIKSJWAWWYJJPCDB... |
| correct output |
|---|
| GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE... |
| user output |
|---|
| NLAHLYPRFCZKIKSJWAYPCDNWYMRCEH... |
Error:
*** Error in `input/code': corrupted size vs. prev_size: 0x000000000164a400 ***
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| PISHWMOTCDDZFRMYMOMYDYYGJZIQHS... |
| correct output |
|---|
| PISHWMOTCZFRMYMOMYDGJZIQHSVAOK... |
| user output |
|---|
| PISHWMOTCZFRMYMOMYDGJZIQVAOKCV... |
Error:
*** Error in `input/code': free(): invalid next size (fast): 0x0000000002362410 ***
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| QUVVTPXAMWWODFXRONJODPGBTCISGM... |
| correct output |
|---|
| QUTPXAMODFXRONJODPGBTCISGMVRBW... |
| user output |
|---|
| TPXAMODFXRONJODPGBTCISGMRBWRZH... |
Error:
*** Error in `input/code': free(): invalid next size (fast): 0x0000000001241410 ***
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
| correct output |
|---|
| POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
| user output |
|---|
| POXHAHYEZTLYNFSLABODMRNKDSKROZ... |
Error:
*** Error in `input/code': free(): invalid next size (fast): 0x0000000001cb8410 ***
