ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1526. Martian Plates

First test doesn't fit the statement limitations! (+)
Posted by Yermak 11 Aug 2012 20:38
#include <stdio.h>
int p,t,n,m;
int main()
{
    scanf("%d%d%d%d",&p,&t,&n,&m);
    if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100)
        return 1/(p-p);
    return 0;
}

This program gets "Crash (integer division by zero)" at test #1.
http://acm.timus.ru/status.aspx?space=1&num=1526
Re: First test doesn't fit the statement limitations! (+)
Posted by Sandro (USU) 12 Aug 2012 13:08
You are right, m = 0 in the 1st test. This limitation in the problem statement is fixed now.
Re: First test doesn't fit the statement limitations! (+)
Posted by Andrew Sboev [USU] 12 Aug 2012 16:06
But there is a division by zero in his code! Sandro, why did you delete my post?
Re: First test doesn't fit the statement limitations! (+)
Posted by Sandro (USU) 13 Aug 2012 01:34
Because the solution of Yermak is a input validator. If the system verdict on some test is Crash (division by zero), then this test is incorrect. If the test is correct, system verdict should be Wrong Answer.
Re: First test doesn't fit the statement limitations! (+)
Posted by Andrew Sboev [USU] 13 Aug 2012 11:54
Sandro, look at this line of his code! There is a division by zero if condition is true, because p-p = 0!

if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100)
        return 1/(p-p);


Edited by author 13.08.2012 11:55
Re: First test doesn't fit the statement limitations! (+)
Posted by Noob 13 Aug 2012 22:43
Captain Obvious to the rescue!
Re: First test doesn't fit the statement limitations! (+)
Posted by Andrew Sboev [USU] 14 Aug 2012 00:03
Noob, oh, i understand.

Edited by author 14.08.2012 00:04