10512 - A Day in Math-land

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

Moderator: Board moderators

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

Post by .. »

If you are typing the correct problem number,
then no data structure is needed to solve the problem.
This is a maths problem that can be solved in O(1), search for old post you will find the key to solve.
My signature:
  • Please make discussion about the algorithm BRFORE posting source code.
    We can learn much more in discussion than reading source code.
  • I HATE testing account.
  • Don't send me source code for debug.
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am

Reply on 10512

Post by Rocky »

Thank's .. For Your Reply.
Yes That's A Math Problem On Simplify Equation.
But I try Frist And Get WA.
Now I Check All The Prvious Post On It And Try All Input & Output.
But My Answer Is Ok For That's Output.I Can't Understand What's Wrong.
MY Solution Is Integer Solution.
So I Need Help For Some Special Case Or Any Special I/O.
Can You Help Me Please.

THANK's In ADVANCE
Rocky.
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am

About Som Input

Post by Rocky »

What Is The Output For The Following Input

input
2
0 2
0 3

Thank's IN Advance
Rocky
..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

Post by .. »

Case 1:
1 -1
Case 2:
Impossible.
My signature:
  • Please make discussion about the algorithm BRFORE posting source code.
    We can learn much more in discussion than reading source code.
  • I HATE testing account.
  • Don't send me source code for debug.
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am

Post by Rocky »

Thank's For Help
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am

Post by Rocky »

Thank's For Help
mysword
New poster
Posts: 26
Joined: Sun Mar 06, 2005 8:52 am

10512 need help

Post by mysword »

can anyone give some i/o samples?
my program is correct for all the existing samples in the forum, but still get WA...
Thanks
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 10512 - A Day in Math-land

Post by plamplam »

Nice problem!! Although I must say that I undrestimated the problem at first sight :x . A very well-designed and sophisticated judge data, great job Shahriar Manzoor. I got AC with long long int, I think double/long double would also work fine as many others claimed to get AC with these, but I would certainly recommend long long int.
Don't use int because my program got the verdict Wrong Answer with int. Also make sure you are printing a '.' after Impossible
Possible reasons why your program might get a Wrong Answer:
1. Your algorithm is incorrect.
2. Your algorithm can't handle cases like 0 0, 1 0, 0 8, -1 0, -5 -7, etc
3. I got wrong answer twice because of this silly mistake. The problem clearly says if there are multiple solutions of x and y, then print the set of solutions with the lowest value of x(I actually ignored this statement as Im very impatient :wink: ). Now consider the case 2 0. What should be the output here? My AC code, gives -1 -1. But notice that 1 1 is also another possible solution, but here as -1 is < 1 we have to print the former set of values.
Now finally some I/O which I generated after solving this problem. Hope I can help you :) Thanks.

Code: Select all

40
8 12
12 8
4 6
0 0
0 1
0 2
0 8
0 64
0 32
0 31
0 20
2 0
1024 0
65536 0
729 0
5 3
-4 -6
-2 -12
8 -12
0 -1
-16 0
16 24
24 16
512 0
0 512
26250 -3125
20902684 1580181
1006826600 48139500
7950 4268
12343210 3702963
-1381662 11479312
1250075001 -25000
1539187879 149758950
2112313210 37032963
2185144815 -35798642
2185144814 -35798642
1006826601 48139500
1006826600 48139501
1006826600 48139500
2147294608 33311922

Code: Select all

Case 1:
2 -4
Case 2:
4 2
Case 3:
3 1
Case 4:
0 0
Case 5:
1 0
Case 6:
1 -1
Case 7:
2 -2
Case 8:
8 0
Case 9:
4 -4
Case 10:
Impossible.
Case 11:
Impossible.
Case 12:
-1 -1
Case 13:
0 -32
Case 14:
0 -256
Case 15:
0 -27
Case 16:
Impossible.
Case 17:
Impossible.
Case 18:
Impossible.
Case 19:
Impossible.
Case 20:
Impossible.
Case 21:
Impossible.
Case 22:
6 2
Case 23:
2 -6
Case 24:
-16 -16
Case 25:
16 -16
Case 26:
-25 -150
Case 27:
3567 3124
Case 28:
23950 21940
Case 29:
97 53
Case 30:
3333 2222
Case 31:
3133 -531
Case 32:
-25000 -25001
Case 33:
31350 26573
Case 34:
33333 32222
Case 35:
-32222 -33333
Case 36:
Impossible.
Case 37:
Impossible.
Case 38:
Impossible.
Case 39:
23950 21940
Case 40:
33513 32519
Lol if you still get Wrong Answer after matching all of the above I/O and you have considered that you need to print the set with lowest value of x if multiple solutions exist, then no one can help you :wink: :wink:.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson
Post Reply

Return to “Volume 105 (10500-10599)”