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 1644. A Whole Lot of Walnuts

What's wrong????
Posted by Rudnev Vladimir 23 Feb 2010 00:21
This is my solution. I have WA at 7-th test. Why?

var i,n,hu,sa:integer;
a:array[1..100]of integer; b:array[1..100]of string;
begin
read(n);
hu:=3;
sa:=10;
for i:=1 to n do begin
read(a[i]);read(b[i]);
if b[i]=' hungry' then
if a[i]>hu then hu:=a[i] else hu:=hu
else if a[i]<sa then sa:=a[i] else sa:=sa;
end;
if hu<sa then writeln(sa) else writeln('Inconsistent');
end.

Edited by author 23.02.2010 00:54
Re: What's wrong????
Posted by Sergey Lazarev (MSU Tashkent) 23 Feb 2010 00:35
"Inconsistent"
Re: What's wrong????
Posted by Rudnev Vladimir 23 Feb 2010 00:53
Thanks, but now I've got WA on 7-th test=((
Re: What's wrong????
Posted by Sergey Lazarev (MSU Tashkent) 23 Feb 2010 10:49
Test:
1
3 satisfied

Answer: 3
Re: What's wrong????
Posted by Rudnev Vladimir 24 Feb 2010 23:12
Why?
russian: если по условию он минум от 3 остается голодным, а тут 3 наелся, это противоречие!
Re: What's wrong????
Posted by Sergey Lazarev (MSU Tashkent) 25 Feb 2010 00:07
In statement: "Попугай заведомо наестся десятью орехами и заведомо останется голодным, съев лишь два"
Where do you see 3?
Re: What's wrong????
Posted by Rudnev Vladimir 27 Feb 2010 22:00
Sorry
Re: What's wrong????
Posted by sbidujko 20 Sep 2011 19:55
Test #7
2
4 s
3 s
Correct answer is 3, not 'Inconsistent'