Common BoardCan i replace position of + and =? For example can i answer for 1+12=13 100 ---- 11+2=13 Are there leading zeroes in input, and can i output answer with leading zeroes? Edited by author 06.03.2007 22:48 1) Yes 2) Statement is now updated I have similar question about relative order of + and =. E.g. can the answer become 3=1+2 ? One more thing should be added to problem statement - new sequence must be left/top-aligned with original one. E.g. it should be impossible to convert 1+33=441 into 11+33=44 by moving rightmost 1 to the left. I tried that when I struggled WA40, but this extension gave WA9. (WA40 was wrong paint of digit 2 :) Edited by author 16.08.2008 14:25 ok, I got it Edited by author 23.03.2008 13:47 Could you tell me why?~~
Thanks in advance!~~ This problem is very simple. I think it can be more interesting if one of dimensions can be odd. For example: 4 5 1 1 2 2 3 4 5 5 6 3 4 7 7 6 10 8 8 9 9 10 Another example: 2 3 1 2 3 1 2 3 Anyway, bipartie algo does not depend on that :) That tests aren't correct. "M and N are EVEN numbers not exceeding 100" Cube has 24 start position. All position possible? Yes. You can start from any position, but upper side in final position must be equal to upper side of start position. I am trying to take all possible combinations of k and run union-find to check if 0-1 are connected in that combinations. complexity is O(M(2^K)). is there a faster approach? Edited by author 16.08.2008 01:01 I submitted several times but got TL#4. Where is my fault? var r,p,m,n,i:longint; kod:integer; j:shortint; q,s,t:string[10]; st:array [1..1000000] of string[50]; begin readln(n); str(n,q); r:=1; for i:=1 to length(q)-1 do r:=r*10; i:=n-r; repeat inc(i); str(i,s); j:=0; repeat inc(j); t:=s; delete(t,j,1); val(t,m,kod); if m+i=n then begin inc(p); st[p]:=s+' '+'+'+' '+t+' '+'='+' '+q; break; end; until j=length(s); until i=n; writeln(p); for i:=1 to p do writeln(st[i]); end. What's the min value of the first number. I mean it's min value according to N Edited by author 22.11.2007 14:40 Simple Problem. Just solve it. Go from last digits to first. zhanbolatinalmaty 1222 15 Aug 2008 23:04 who can me help? Beside I do not pass the test a number 7. wait the answer. plz,help mi. Who knows test 7?? What I must write if n=1? Please, give me answers for tests: 1 1 1 (yes, it's uncorrect ;) 1 2 1 1 3 1 1 4 4 Edited by author 08.04.2007 16:10 Hi evil cheater!:) my prog out 1 3 4 Hi, friend! =) My prog out 1 3 4 too, but I get WA#6. I using hash. You have any good (or evil :) tests for me? And what answers for this: 5 2 1 1 1 1 1 -> 22 4 12 1 5 3 5 11 -> 1781 5 45 18 33 1 1 45 -> 41312 n=2 -> s*s Edited by author 08.04.2007 20:31 I solved it! It's not hard as you think. Using hash, you must deleting 1-step queen places only. My time is 1.687 Thanks! There're about 3e+6 positions before reduction to 1e+6. So, it's too compacted for hasing. You'll either get TLE or ML, or you're lucky :) My solution eats 2.4 sec, but it spends most of its time inside qsort. And I couldn't do any bucketing due to ML :( One method uses formula a4=(t1^4-6*t1^2*t2+3*t2^2+8*t1*t3-6*t4)/24 mod p For it we must find previously 24^(-1) mod p But it needs in loop with ~ p=10^9 iterations May this calculation lead to TL before main program? Why can't we use extended euclid? or use fermat little theorem a^(p-1) = 1 (mod p) a^(p-2).a = 1 (mod p) so a^(-1) = a^(p-2) :) // O(a) inline int inv(int a) { for (int i = 1; ; i++) { int64 b = (int64) P * i + 1; if (b % a == 0) return int(b / a); } return 0; } Best advise was extended evclid I could apply it during the context. But 1560 wuild bettter to solve in Java using BigInt We simply use /24 at the end and avoid many %p operations. a/b mod p = a*b^-1 mod p = a*b^(-1 mod p-1) mod p = a*b^(p-2) mod p. b^(p-2) can be precomputed using logarithmic powering. I needed only divisors 2, 6 and 24. I'm getting f**ing TL on the test 11. I'm using java and solved the problem as it is supposed to be in JAVA. I used objects "standings" which contains id and m( i.e. standing( id, m ) ). I'm using bubble sort since quicksort gives wrong answer. Does anyone know how to gid rid of the Time Limit using JAVA? I know JAVA is slowest compiler i've ever seen :-) Please, need help I use JAVA. On #11 TL too......1.015senconds... There are some hits: 1.don't use class,it will use a lot of time. 2.Using Scanner and PrintWriter can help you input/output a little faster. 3.I use a O(n) method....1.015senconds TL...JAVA is slow AC!! 1.A O(n) method 2.in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); //for input 3.PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); //for output 4.out.print(id); out.print(" "); out.println(m); //print them one by one for fast output 0.984s & 8 402 KB WTF!:) Edited by author 11.08.2008 02:38 There are only 101 Ms, so you just appear to be a little "stupid" for(i=100;i>=0;i--){ for(j=0;j<N;j++) if(stu[j].M == i) printf("%d %d\n", stu[j].ID, stu[j].M); } Is it possible to solve this problem in Java without MLE? If we use HashMap<Integer,Long> as "cache" we get 287k entries in worst case. Even if ww think about raw data (no objects, no overlap) - it is 3.4Mb Still thinking how to avoid "full-sized" caching (h X m+h X n). Finally I solved this problem in Java =) To reduce cache size I used fact that for any N >= Nmax we get f(N,M,H)=const. As analys of cache has shown - it is about 85% of entries. So I built 3 tables - Nmin, Nmax and F. After that i has maximum 56k entries. But that was also too much for system (huh, i tested on my machine - it got used slightly less than 4Mb...) I read discussions about this problem and used one hint - we can cache, for example, only even levels. As for performance - it is just 2 times slower... but it gets 2 times less memory... Exactly what we need =) Good luck. What about this test? maybe there isolated node? some like this 3 1 100 50 10 2 3 10 Edited by author 14.08.2008 23:02 If a girl does not like the boy who loves her, how do we resolve collisin. And if there is more than two boys and girls not liking anyone how do we resolve that. And if Boy A loves girl B Girl B loves boy C Boy C loves nobody how to proceed? Let Boy A go with Girl B, and Boy C go with any girl that loves Boy C or nobody To 1st post: that's not collision but ambiguous result. Any is ok. Edited by author 14.08.2008 22:26 Can anyone tell me what is wrong in answer to test: 4 0 4 1 2 0 0 3 0 ans: 3 4 1 2 and where is it written in problem description? in my opinion it is correct output according to problem statement. Am I wrong? Best Regards! please - answer also to tu219717@students.mimuw.edu.pl You can't pair 1st boy with the 3rd girl because neither of them like each other, and they are not both zero. Edited by author 14.08.2008 22:05 I got TLE when I used Java,and got AC used C++.. And another question is what's the meaning of Crash? Stack overflow or buffer overflow ?How can I get AC using my JAVA program?Please help me..thank you! Here is my java program import java.io.*; import java.util.*; import java.math.*; import java.text.DecimalFormat; public class Main{ static double c[]=new double[500000]; public static void main(String argsp[]){ Scanner cin=new Scanner(System.in); int i=0,n; while(cin.hasNext()){ c[i++]=cin.nextDouble(); } n=i; for(i=n-1;i>=0;i--){ DecimalFormat df=new DecimalFormat("0.0000"); System.out.println(df.format(Math.sqrt(c[i]))); } } } and my C++ program have got AC..nearly the same as Java #include <stdio.h> #include <math.h> double a[500000]; int main() { int i,n; i=0; while(scanf("%lf",&a[i++])!=EOF); n=i-1; for(i=n-1;i>=0;i--) printf("%.4lf\n",sqrt(a[i])); } Ну тогда тренируйса будит чудеса и получеш AC pls help me... Друг мой ты какой класс исползуеш. Eсли исползуюш tokeni ну тогда while (true) { in.nextToken(); if (in.ttype ==StreamTokenizer.TT_EOF) break; a.add(in.nval); } what about case when all three points are on line I think it's impossible to find required position as proper as we can't draw circle throw three points on one line Why do you think about the circle? The answer is obvious in such case, and it's the central point. Ok.. here is my hint: Choose p large enough to be sure you are in period of the given sequence and try findind q. Edited by author 07.09.2008 13:47 |
|