## 10880 - Colin and Ryan

All about problems in Volume CVIII. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

### 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.

Cho
A great helper

Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

There are cases with C=R, in spite what the problem statement says.

Krzysztof Duleba
Guru

Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland

My code output nothing for that case.
Is that correct?

Cho
A great helper

Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

There was a clarification (http://online-judge.uva.es/board/viewtopic.php?t=8581):
In the case R == C, the answer should be "0".
mf
Guru

Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland

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.

abishek
Experienced poster

Posts: 131
Joined: Mon Dec 15, 2003 5:41 am

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.

Krzysztof Duleba
Guru

Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland

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.

misof
A great helper

Posts: 430
Joined: Wed Jun 09, 2004 1:31 pm

Yes, sorry about that mistake.

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.
Let's hope Yury doesn't notice that I'm solving problems again.

Abednego
A great helper

Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

What should be the output of " 100 0 "

ibrahim
Experienced poster

Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh

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

Cho
A great helper

Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

hi.. i got WA.. i don'k know why I got WA...

Do you show some data for input and output ??
pipo
New poster

Posts: 47
Joined: Tue May 11, 2004 6:43 pm
Location: Republic of Korea

hi pipo, check it out:

input:
Code: Select all
`152000000000 4010000000 0909090 9090900 0100 084946644 544146 44843 45818481 2157181994 5185161 7441 0441 1099999999 3333818181 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 1999999960Case #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 10000000Case #3: 0Case #4: 0Case #5: 1 2 4 5 10 20 25 50 100Case #6: 849461 1698922 3397844 4247305 8494610 16989220 21236525 42473050 84946100Case #7: 71 142Case #8: 2399 4798Case #9: 4597 9194 409133 818266Case #10: 134531 245867 7130143Case #11: 9 18 27 54Case #12: 1 3 7 9 21 49 63 147 441Case #13: 431Case #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 99996666Case #15: 163633 818165`
Jalal : AIUB SPARKS

CodeMaker
Experienced poster

Posts: 183
Joined: Thu Nov 11, 2004 12:35 pm

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.
pipo
New poster

Posts: 47
Joined: Tue May 11, 2004 6:43 pm
Location: Republic of Korea

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!

Sedefcho
A great helper

Posts: 375
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria

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 2000000int 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)

rube
New poster

Posts: 18
Joined: Thu Oct 28, 2004 10:13 am

Next