You are not logged in. Please login at www.codechef.com to post your questions!

×

SIGCONT Errors

Hello,

So I have a rather simple program, with a rather large text entry. Allow me to show you some simple C++ code.

#include <iostream>
#include <string>
using namespace std;

int main() {
    // your code goes here
    std::string input;
    input.reserve(60000);
    cin >> input;
    bool repeat = true;
    do 
    {
        repeat =false;
        for (  auto it = input.begin(); it != input.end(); ++it )
        {
            auto nextchar = next(it); 
            if( *it - *nextchar == 32 || *nextchar - *it == 32 )
            {
                repeat = true;
                input.erase( it, ++nextchar);
                break;
            }
        }
        //cout << "String is " << input << endl;
        cout << "Did a loop\n";
    } while (repeat == true); 
    cout << "String length is " << input.length() << endl;
    return 0;
}

Seems simple.

But my input is MASSIVE. But I think it's killing the query here so here's about 30 characters You can dupe it 1000 times to get a realistic input.

RrhGgHUQOzZoeErRpPBbiIhHquNnHhUgGsSbBZzNXfFxnRrupaoOXxrRAaAPDdNORnNDdrCc

If you run this code it seems to run and then throws an error SIGCONT. It seems like I'm tripping something. remove the Did a Loop output, and everything runs fine. Move the string length count into the do while loop, it throws SIGCONT again? the code only executes .01 seconds, but it seems like it doesn't like the output.

I really like Codechef, and I'm using it to write simple code for ... well I don't want to say where this code is from (Spoilers), but things like project Euler and similar, but that error seems to limit my debugging capabilities here. I use a Chromebook at home so Codechef is super useful for me, so is there anyway around this?

Thanks for the answer, and I hope this isn't a really stupid question.

asked 06 Dec, 04:19

kinglink's gravatar image

0★kinglink
1
accept rate: 0%

I don't know why you don't want to share the question source.

(06 Dec, 10:57) black_truce4★

Because it doesn't really matter to the question. And this code will be a answer for one of their questions.

If there's a reason you need to know where it comes from feel free to ask, but the code and the input is what's important.

(06 Dec, 16:32) kinglink0★

It's because I'm not getting SIGCONT error from any of the inputs. With or Without keeping your commented statements. Your code seems okay. But I can't assure you its perfect until I have the exact question.

(06 Dec, 18:47) black_truce4★

Fair enough. It's taken from adventofcode.com. Each input is unique so mine is available at https://pastebin.com/6mMqQSAc

I just tried it again, that Custom input on a single line, and that code gave me a SIGCONT.

(08 Dec, 12:19) kinglink0★

You exceeded the IDE's printing limit. Hence you are getting SIGCONT.

For Codechef IDE, it's around 2^16 Characters.

You can try printing the output directly in a file locally.

But as you are using chrome os, I doubt if you can compile and execute locally. Mostly, you'd be using online compilers. If so, then check out geeksforgeeks IDE which has a higher limit. Also, you can install linux on Chromebook. You'd definitely find how to do so on the internet.

link

answered 08 Dec, 14:11

black_truce's gravatar image

4★black_truce
964
accept rate: 38%

edited 08 Dec, 14:12

1

I knew it would be something foolish. That completely makes sense. And outputting that string would get me near the limit as well.

Thank you very much Black_truce. I appreciate your time and will consider if I need that much output (I probably don't).

(08 Dec, 16:29) kinglink0★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,287
×1,887
×503
×119
×24

question asked: 06 Dec, 04:19

question was seen: 120 times

last updated: 08 Dec, 16:29