***Time limit exceeded***

***Time limit exceeded***

de către Вася Пупкин-
Număr de răspunsuri: 2

Hello.

I have a program that passes some tests and some does not with the error ***Time limit exceeded***.

The problem is that as soon as the program does not pass the time test, the check stops and the rest of the tests do not run.

How do I make the results of all tests displayed?

Thanks

Sample program:

#include <iostream>
using namespace std;
int main() {
    int a;
    cin >> a;
    if(a == 1){
        while(1);
    }
    else {
        cout << a;
    }
    return 0;
}

Input and output data:
Input: 2
Output:2

Input: 1
Output: ***Time limit exceeded***

Input: 3
Output:3

Ca răspuns la Вася Пупкин

Re: ***Time limit exceeded***

de către Richard Lobb-
This question is closely related to this thread. But time-limit exceeded is perhaps a bit more problematic. Do you really want to display all test results, even if every one gets stuck in a loop? If there's, say, a 5 second timeout and 10 tests, that's 50 seconds of wasted time for both the Jobe server and the student waiting for their response. I think the current system, which throws the job out if a test case is looping, is the right approach if you're using all-or-nothing grading. If you're giving marks per test case I suppose there's a case for letting the tests grind on, though my gut feeling is still that it's better to let the student try again, with a penalty, rather than trying to give marks to a flawed submission.

Anyway, to answer your original question, if you want testing to proceed after a run-time error of any sort you'll need to catch the error yourself. We use a complex combinator grader in which we have our own watchdog timer that kills the run well before the Jobe timeout limit is reached. You can see our question type on the github repository here if you like, but it's very complex, having evolved over years, and it probably not what you want. A simpler solution would be to follow the general approach in that other thread (here). Where that thread recommends catching runtime errors, you could instead use a watchdog timer.
Ca răspuns la Richard Lobb

Re: ***Time limit exceeded***

de către Вася Пупкин-
Hello. I want to clarify that I use the "multilanguage" question type and I don't understand Python.
Can you tell me exactly what to do.
Thanks.