Show all threads Hide all threads Show all messages Hide all messages |
What is the correct output to this test? | Yunzhong | 1071. Nikifor 2 | 8 Jul 2022 19:55 | 5 |
1. Input: 7122 2119 2. Input: 7122 2120 My AC program outputs next: > 1. Input: 7122 2119 Output: 4923 > 2. Input: 7122 2120 Output: 2501 > 1. Input: 7122 2119 5003 > 2. Input: 7122 2120 2501 > 1. Input: 7122 2119 5003 > 2. Input: 7122 2120 2501 I'm too ! List of posible solutions (I think) 7122 2119 Base 5003 12119 => 2119 Base 2966 21190 => 2119 Base 2965 21192 => 2119 Base 2964 21194 => 2119 Base 2963 21196 => 2119 Base 2962 21198 => 2119 (1) Base 423 16354 => 54 (2) Why 1 or 2 dont can be solutions?, there is something I am not seeing? Edited by author 08.07.2022 19:57 |
Who can give me some tests?I got WA all the time!(+) | Acid Pea | 1071. Nikifor 2 | 19 Feb 2021 15:53 | 7 |
program p1071; var x,y,z,s,i:longint; out:boolean; procedure check(p:longint); var x1,y1:longint; c:array[0..10000] of integer; begin fillchar(c,sizeof(c),0); x1:=x;y1:=y; repeat inc(c[x1 mod p]); x1:=x1 div p; until x1=0; repeat if c[y1 mod p]>0 then dec(c[y1 mod p]) else exit; y1:=y1 div p; until y1=0; out:=true; end; begin readln(x,y);z:=0;out:=false; for i:=2 to x do if x mod i=y mod i then begin check(i); if out then break; end; if out then write(i) else write('No solution'); readln; end. |
WA4 | Grandmaster | 1071. Nikifor 2 | 23 Jan 2017 00:19 | 1 |
WA4 Grandmaster 23 Jan 2017 00:19 |
Faster Ideas | georgi_georgiev | 1071. Nikifor 2 | 30 Dec 2016 00:39 | 4 |
I Solved this problem, by transforming x and y into every system and search for the longest common substring. But I am interested in another Ideas, better than mine, except brute force. it isn't necessary to search LCS (O(|x|*|y|)), you can check only what y is subsequence of x, so it will be O(|x|+|y|) Edited by author 30.08.2009 16:00 Verification of this fact is O(log(max(x,y))) base = 2..1000 bruteforce, base > 1000 think a little :)) |
#2 | Domacles | 1071. Nikifor 2 | 30 Jul 2013 10:43 | 1 |
#2 Domacles 30 Jul 2013 10:43 |
What does "number system" means ? What is the limit of it ? | Tran Nam Trung (trungduck@yahoo.com) | 1071. Nikifor 2 | 22 Nov 2012 12:31 | 6 |
Can anybody tell me what exactly "number system" means? I can't understand what TNT and DQH talking about. maximal number system base is not more than 1 million. |
WA#2 Help | ACSpeed | 1071. Nikifor 2 | 2 Dec 2011 21:53 | 1 |
I basically used brute force, if ( x==y) cout<<2; if (x < y) cout<<"No solution"; then the rest brute force |
WA 15 | Robert_Khasanov(MSTU STANKIN) | 1071. Nikifor 2 | 3 Apr 2011 13:25 | 3 |
WA 15 Robert_Khasanov(MSTU STANKIN) 23 Jan 2008 20:10 Please give me some tests. try this: 1000000 499999 Edited by author 28.05.2008 22:05 |
Why WA in test №7? What's wrong? Who can help me? | ПирожкомейкерЪ | 1071. Nikifor 2 | 26 Nov 2009 15:49 | 1 |
var x,y,x1,y1,f,l:longint;a,b,c:array[1..1000] of byte; i,k,s,r,w,z:word; begin read(x, y); l:=2;w:=0; While (f<>1)and(l<=10) do begin i:=1; x1:=x; s:=0; c:=a; b:=a; Repeat c[i]:=x1 mod l; x1:=x1 div l; inc(i); inc(s) until x1=0; y1:=y;k:=0; i:=1; Repeat b[i]:=y1 mod l; y1:=y1 div l; inc(i); inc(k) until y1=0; r:=b[k];z:=1;i:=s; Repeat If c[i]=r then begin r:=b[k-z];inc(z);end; dec(i); until (z=k+1)or(i=0); If z=k+1 then begin f:=1;w:=l;end; inc(l); end; If w=0 then writeln('No solution') else writeln(w) end. Help me please... |
BRUTEFORCE rulzzzzzzzzzzzzzz | Roast | 1071. Nikifor 2 | 3 Aug 2009 18:13 | 1 |
The best way to solve this problem is with bruteforce... My brute: 0.031 121KB :) |
who used dinamic programming, please tell where it use | Головченко Дмитрий | 1071. Nikifor 2 | 11 May 2009 19:58 | 1 |
|
CAN YOU EXPLAIN THE QUETION NIKIFIR 2 EMILBEK_4@NETMAIL.KG | Emilbek | 1071. Nikifor 2 | 27 May 2008 15:49 | 1 |
|
Problem 1071 "Nikifor 2" has been rejudged (+) | Vladimir Yakovlev (USU) | 1071. Nikifor 2 | 5 May 2008 21:31 | 1 |
New tests have been added. 15 authors have lost AC. |
I use Dynamic Programing ,which find LCS to solve this problem.I got AC,but it is too slow!!! | Yu YuanMing | 1071. Nikifor 2 | 25 Mar 2007 20:02 | 5 |
Yes, first I ACed the bruteforce algorithm in 0.187 sec, but later I added to it some mathematical hint. Now it works 0.046 sec. 866224 Hard (DHSP) Pascal Accepted 0.14 121 KB you can have O(s(x)+s(y)) instead of LCS s(a) is length of a in one's radix. Brute Force with 0.046 sec and 960 Memory |
What is the trick in test 11? | AlMag | 1071. Nikifor 2 | 19 Jan 2007 17:29 | 1 |
I WAS one of the ACers in this problem. I thought my algo was correct until... Can U tell me some tests to find out my mistake(s)? |
Problem 1071 "Nikifor 2" has been rejudged (+) | Sandro (USU) | 1071. Nikifor 2 | 15 Jan 2007 15:34 | 1 |
New tests were added. 169 authors lost AC. |
What's the output for... | Alexey | 1071. Nikifor 2 | 12 Jun 2006 20:45 | 1 |
200 3 100 100 100 Is it -1? Edited by author 13.06.2006 11:57 |
Bruteforce with 0.001s and 146KB?! | tretyakov[ssau_618] | 1071. Nikifor 2 | 2 Feb 2006 16:57 | 1 |
How is it possible? There are really power server! |
Wrong answer test(6) Why?Help me+++++ | Виктор Крупко | 1071. Nikifor 2 | 4 Apr 2005 02:44 | 6 |
program de; var a,n,i,r,x,y,step,j:longint; q:boolean; s1,s2,s:string; begin step:=1; q:=false; read(x); read(y); repeat s1:=''; s2:=''; n:=x; inc(step); repeat i:=n mod step; n:=n div step; str(i,s); s1:=s+s1; until n=0; r:=y; repeat i:=r mod step; r:=r div step; str(i,s); s2:=s+s2; until r=0; j:=1; for i:=1 to length(s1) do if (s1[i]=s2[j]) and (j<>length(s2)+1) then inc(j); if j=length(s2)+1 then q:=true; until (step=x+1) or q; if q then writeln(step) else writeln('No solution'); end. For test 11 10 Your program writes 11 My AC program writes 'No solution' My AC program uses bases from 2 to 100000 How???? Виктор Крупко 4 Apr 2005 02:12 How to organize translation in other system of calculation, it is more 9 Part of my AC program: leny = lenx = 0; while (x > 0) ax[lenx++] = x % base, x /= base; while (y > 0) ay[leny++] = y % base, y /= base; x, y - decimal numbers base - system of calculation ax[], ay[] - x and y in new system lenx, leny - its lengths |
Help me!!!!!!!! why 6 test wrong answer???????? | Виктор Крупко | 1071. Nikifor 2 | 31 Mar 2005 00:23 | 1 |
program de; var a,n,i,r,x,y,step,j:longint; q:boolean; s1,s2,s:string; begin step:=1; q:=false; read(x); read(y); repeat s1:=''; s2:=''; n:=x; inc(step); repeat i:=n mod step; n:=n div step; str(i,s); s1:=s+s1; until n=0; r:=y; repeat i:=r mod step; r:=r div step; str(i,s); s2:=s+s2; until r=0; j:=1; for i:=1 to length(s1) do if (s1[i]=s2[j]) and (j<>length(s2)+1) then inc(j); if j=length(s2)+1 then q:=true; until (step=x+1) or q; if q then writeln(step) else writeln('No solution'); end. |