## 10880 - Colin and Ryan

Moderator: Board moderators

Cho
A great helper
Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

### 10880 - Colin and Ryan

I used some part of my code of 10858 to solve this problem.
1. Find all factors of C-R
2. Output those factors which are > R
Got WAs during the contest.
Many people solved this one in the contest. Is there anything I missed? Just hope it's not a hidden bug from the re-used code.

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:
There are cases with C=R, in spite what the problem statement says.

Cho
A great helper
Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong
My code output nothing for that case.
Is that correct?

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:
There was a clarification (http://online-judge.uva.es/board/viewtopic.php?t=8581):
In the case R == C, the answer should be "0".

abishek
Experienced poster
Posts: 131
Joined: Mon Dec 15, 2003 5:41 am
this was stupid!
I think that the problem must have been rejudged, and the solution must have been changed, rather than changing the question.
its not right to expect ppl to refresh the clarifications page.

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:
abishek wrote:its not right to expect ppl to refresh the clarifications page.
Huh? That's perfectly right. This is what that page is for.

misof
A great helper
Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm
Krzysztof Duleba wrote:
abishek wrote:its not right to expect ppl to refresh the clarifications page.
Huh? That's perfectly right. This is what that page is for.
+1

Clarifications == announcements during the contest. You are expected to read the clarifications, especially if you believe that your solution is correct and the judge says otherwise. The other option is to submit a clarification request. Did you do that?

I did A bit of insight: During the contest Abednego found out that the problems with a special judge aren't judged correctly (most probably UVa had a buggy description how should the special judge behave). He was too busy fixing this issue, especially the task B many people submitted already. The best he could do was to post a clarification about the problem C.

I posted a clarification request, he admitted that the output in the case C==R is wrong, but there was nothing better he could do at that time.

My opinion is that rejudging the submissions after the contest would be a good idea... But -- due to the clarification both solutions for the R==C case should be accepted.

Abednego
A great helper
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA
Contact:

I learned an important lesson there. When I ask two people to write an alternate solution to my problem, and both of their solutions give an answer that is different from mine, then there might be something wrong with the problem. :-) I'm too arrogant.

The problem statement, when it is posted to the archive, will have a correction. A better way would be to fix the judge's solution, but it's a minor issue, and I think that it would cause more trouble than simply adding a sentence to the problem description.
If only I had as much free time as I did in college...

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Contact:
What should be the output of " 100 0 "

Cho
A great helper
Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

Code: Select all

``Case #1: 1 2 4 5 10 20 25 50 100``

pipo
New poster
Posts: 47
Joined: Tue May 11, 2004 6:43 pm
Location: Republic of Korea
hi.. i got WA.. i don'k know why I got WA...

Do you show some data for input and output ??

CodeMaker
Experienced poster
Posts: 183
Joined: Thu Nov 11, 2004 12:35 pm
hi pipo, check it out:

input:

Code: Select all

``````15
2000000000 40
10000000 0
909090 909090
0 0
100 0
84946644 544
146 4
4843 45
818481 215
7181994 51851
61 7
441 0
441 10
99999999 3333
818181 16``````
output:

Code: Select all

``````Case #1: 46 56 70 92 115 140 161 184 230 280 322 460 644 805 920 1288 1610 3220 6440 310559 621118 1242236 1552795 2173913 2484472 3105590 4347826 6211180 7142857 8695652 10869565 12422360 14285714 17391304 21739130 28571428 35714285 43478260 49999999 57142856 71428570 86956520 99999998 142857140 199999996 249999995 285714280 399999992 499999990 999999980 1999999960
Case #2: 1 2 4 5 8 10 16 20 25 32 40 50 64 80 100 125 128 160 200 250 320 400 500 625 640 800 1000 1250 1600 2000 2500 3125 3200 4000 5000 6250 8000 10000 12500 15625 16000 20000 25000 31250 40000 50000 62500 78125 80000 100000 125000 156250 200000 250000 312500 400000 500000 625000 1000000 1250000 2000000 2500000 5000000 10000000
Case #3: 0
Case #4: 0
Case #5: 1 2 4 5 10 20 25 50 100
Case #6: 849461 1698922 3397844 4247305 8494610 16989220 21236525 42473050 84946100
Case #7: 71 142
Case #8: 2399 4798
Case #9: 4597 9194 409133 818266
Case #10: 134531 245867 7130143
Case #11: 9 18 27 54
Case #12: 1 3 7 9 21 49 63 147 441
Case #13: 431
Case #14: 4242 4286 6429 6666 7777 12858 15001 15554 23331 23573 30002 45003 46662 47146 70719 90006 141438 165011 216443 330022 432886 495033 649329 990066 1298658 1515101 2380873 3030202 4545303 4761746 7142619 9090606 14285238 16666111 33332222 49998333 99996666
Case #15: 163633 818165
``````
Jalal : AIUB SPARKS

pipo
New poster
Posts: 47
Joined: Tue May 11, 2004 6:43 pm
Location: Republic of Korea
thank you.. CodeMaker...

well... My output is right exactly on your output...

Is any critical input ??

my solution is simple...

my code is below... help me please...

Code: Select all

``````deleted after accepted...
``````
Last edited by pipo on Thu Aug 11, 2005 10:40 am, edited 1 time in total.

Sedefcho
A great helper
Posts: 374
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria
Pipo,

I took your code and I slightly changed it and now it gets ACC.
What are the changes I made?
I don't change all the time the value of the variable max as you
do in your loop. I just fix it in the very beginning like this :
max = (int)(sqrt(temp) + 1);
and I never change it inside the loop.

This is maybe the most important change I did. I also do not use a
stack, just two arrays but I don't think this is so significant.
Still, who knows...

I also changed the value of MAX. Your constant MAX=1024 is
too small, I think. Makes no harm if we make it 1024*1024 let's say.

I also changed this condition:
if (temp==0)
to
if (temp<=0)
but I don't know if this changes something.

So one of these changes has obviously fixed some bug which you
had before. Anyway, if you want, you can give me and email address
so that I can send you the changed code which gets ACC.

Regards!

rube
New poster
Posts: 18
Joined: Thu Oct 28, 2004 10:13 am
I don't understand Why I am getting WA.

Code: Select all

``````#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

#define max_f 2000000
int fac[max_f+1],k;
void factor(int n){
int i,sr;
k=0;
sr=sqrt(n);
for(i=1;i<=sr;i++){
if(n%i==0){
fac[k++]=i;
if(i!=sr)
fac[k++]=n/i;
}
}
}
int main(){
int n,T,cas=1,i,r;
//freopen("in.txt","r",stdin);
scanf("%d",&T);
while(T--){
scanf("%d %d",&n,&r);
printf("Case #%d:",cas++);
if(n==r){printf(" 0\n");continue;}
n-=r;
factor(n);
sort(fac,fac+k);
for(i=0;i<k;i++)
if(fac[i]>r){
printf(" %d",fac[i]);
}
printf("\n");
}
return 0;
}
``````
Never argue with an idiot, they'll drag you down to their level and beat you with experience! (unknown)