All about problems in Volume 108. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
sohel
Guru
Posts: 856 Joined: Thu Jan 30, 2003 5:50 am
Location: New York
Post
by sohel » Tue Aug 09, 2005 4:29 pm
Since the range is so small (100), I thought of a bruteforce solution but that gives wrong answer.
My method:
given
A intersection B
B intersectin C
A intersectin C
find A intersectin B intersection C... right?
my code:
Code: Select all
Removed after getting AC..
thanks to mf.
}
Can someone give some input/output... or prove my method wrong.
Last edited by
sohel on Wed Aug 10, 2005 11:33 am, edited 1 time in total.
mf
Guru
Posts: 1244 Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:
Post
by mf » Tue Aug 09, 2005 5:37 pm
The lower bound may be 0, for example in "34 33 33".
sohel
Guru
Posts: 856 Joined: Thu Jan 30, 2003 5:50 am
Location: New York
Post
by sohel » Wed Aug 10, 2005 11:32 am
Thanks..
.. got AC.
Sometimes it is hard to think of the obvious !!
Well, for me anyways.
_.B._
Experienced poster
Posts: 160 Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:
Post
by _.B._ » Sat Aug 13, 2005 4:46 am
Greetings!
Any I/O for spare?
No idea why the WA
Thanks in advance!
_.
sohel
Guru
Posts: 856 Joined: Thu Jan 30, 2003 5:50 am
Location: New York
Post
by sohel » Sat Aug 13, 2005 8:40 am
How do you check whether the given data is faulty?
_.B._
Experienced poster
Posts: 160 Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:
Post
by _.B._ » Sun Aug 14, 2005 4:55 am
Ouch!, forgot to take some comments away after correction
From
Code: Select all
low = obligatorios + (a[0] / 2); // + (a[0] % 2);
to
Code: Select all
low = obligatorios + (a[0] / 2) + (a[0] % 2);
Well, had other mistake.
By the way, I considered data faulty if:
- Higher value is
> than 100.
- Lower value is
< than the intersection of the other 2 values.
Keep posting!
_.
lovemagic
Learning poster
Posts: 52 Joined: Thu Oct 02, 2003 11:38 am
Post
by lovemagic » Fri Jun 23, 2006 2:02 am
i get WA.
can smbody plz tell me what's the output of this input?
71 60 60
72 60 60
70 60 60
72 60 6
10 10 10
34 33 33
33 35 35
0 0 1
1 1 1
34 34 34
100 100 80
80 80 100
khobaib
lovemagic
Learning poster
Posts: 52 Joined: Thu Oct 02, 2003 11:38 am
Post
by lovemagic » Fri Jun 23, 2006 2:25 am
at last got AC.....
i did a mistake & that was:
i overlooked there would be some friday when
Ai != Ci != Mi.
khobaib
ahm.kam_92
New poster
Posts: 4 Joined: Mon Jan 05, 2009 7:21 am
Post
by ahm.kam_92 » Mon Jan 05, 2009 7:27 am
Hi everyone ...
It's my first time here.
i hope it's helpful
i had coded this problem and got WA ...
may anyone suggest any tricky input or check my code ?
Thanks in advance
that is my code:
Last edited by
ahm.kam_92 on Mon Jan 05, 2009 9:09 pm, edited 1 time in total.
helloneo
Guru
Posts: 516 Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea
Post
by helloneo » Mon Jan 05, 2009 4:25 pm
Try this case..
Input
Code: Select all
12
71 60 60
72 60 60
70 60 60
72 60 6
10 10 10
34 33 33
33 35 35
0 0 1
1 1 1
34 34 34
100 100 80
80 80 100
My output is ..
Code: Select all
Case #1: Between 46 and 60 times.
Case #2: Between 46 and 60 times.
Case #3: Between 45 and 60 times.
Case #4: The records are faulty.
Case #5: Between 0 and 10 times.
Case #6: Between 0 and 33 times.
Case #7: Between 2 and 33 times.
Case #8: Between 0 and 0 times.
Case #9: Between 0 and 1 times.
Case #10: Between 1 and 34 times.
Case #11: The records are faulty.
Case #12: Between 80 and 80 times.
ahm.kam_92
New poster
Posts: 4 Joined: Mon Jan 05, 2009 7:21 am
Post
by ahm.kam_92 » Mon Jan 05, 2009 7:30 pm
Oops!
seems that i am stupid .. i have done this conditions to be faulty and that is wrong:
Code: Select all
if(min(a,b)>c){printf("Case #%d: The records are faulty.\n",i+1);continue;}
if(min(a,c)>b){printf("Case #%d: The records are faulty.\n",i+1);continue;}
if(min(b,c)>a){printf("Case #%d: The records are faulty.\n",i+1);continue;}
i hope that is the only bug .. i will try it now.
Thanks very much.
ahm.kam_92
New poster
Posts: 4 Joined: Mon Jan 05, 2009 7:21 am
Post
by ahm.kam_92 » Mon Jan 05, 2009 7:42 pm
still WA
i dunno what is still wrong it is passing all the cases u have suggested.
omar_elruby
New poster
Posts: 2 Joined: Mon Jan 05, 2009 8:34 pm
Post
by omar_elruby » Mon Jan 05, 2009 8:39 pm
check case 7 again, your program gives a wrong output, it's just a small mistake
...
ahm.kam_92
New poster
Posts: 4 Joined: Mon Jan 05, 2009 7:21 am
Post
by ahm.kam_92 » Mon Jan 05, 2009 9:07 pm
it is AC thanks