| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| #11, TLE, Execution time is just 0.14 | min_jie | 1226. йынтарбО кодяроп | 23 фев 2013 11:19 | 1 |
I guess that there must be something wrong in the test of system. Execution time is just 0.14 (even less), and Memory used: 2 008 KB My solution: static void Main(string[] args) { char[] chs = Console.In.ReadToEnd().TrimEnd().ToCharArray(); string tmpStr=""; foreach (char ch in chs) { if (char.IsLetter(ch)) { tmpStr = ch + tmpStr; } else { Console.Write(tmpStr+ch); tmpStr = ""; } } if (tmpStr != "") Console.Write(tmpStr); Console.ReadLine(); } Edited by author 26.02.2013 06:18 Edited by author 26.02.2013 06:34 |
| WHY? Wrong Answer??? | Heng | 1299. Псилонцы | 22 фев 2013 22:23 | 3 |
program URAL1299(input,output); var n,np,m,mp,p,x,yg:longint; ch:char; procedure gfire; begin if (abs(yg)>=10)or(m=0) then writeln('FRONT ',x) else writeln( 'FIRE ',p); end; procedure bfire; begin if (abs(yg)>=5)or(m=0) then writeln('BACKWARD ',x) else writeln('FIRE ',p); end; procedure attack; begin readln(n,np); if n*np>=3*m*mp then gfire else bfire; end; procedure guard; begin if m=0 then begin writeln('STOP');exit; end; if abs(yg)<5 then writeln('FIRE ',p) else begin if yg>=+5 then writeln( 'LEFT ',x); if yg<=-5 then writeln('RIGHT ',x); end; end; procedure defense; begin if m*20>=p then bfire else guard; end; procedure patrol; begin readln(yg);//yg:=yg+180; if m>0 then defense else begin if abs(yg)<=20 then writeln('FRONT ',x) else if abs(yg)>=160then writeln('BACKWARD ',x)else begin if yg<-90 then yg:=+180-abs(yg); if yg>+90 then yg:=-180+abs(yg); if yg> 0 then writeln('LEFT ',x) else writeln('RIGHT ',x); end; end; end; begin readln(x,p); if x>100 then x:=100; if p> 20 then p:= 20; readln(ch);readln(m,mp,yg); case ch of 'G':guard; 'A':attack; 'P':patrol; 'D':defense; end; end. >if x>100 then x:=100; >if p> 20 then p:= 20; You have to use initial values, while finding solution. > if n*np>=3*m*mp This has to be n*np>3*m*mp My solution failed on 14th test, because mine was written like: if n*np*3>m*mp
|
| Cannot allocate an array of constant size 0 | Beso | 1880. Собственные числа Psych Up | 22 фев 2013 19:13 | 1 |
|
| TLE in #11!!! | 胡敏达是猪 | 1031. Железнодорожные билеты | 22 фев 2013 14:59 | 1 |
Could you please give me the file of test node #11??? |
| Test #1 | BrainFuck | 1110. Степень | 22 фев 2013 10:02 | 1 |
Test #1 BrainFuck 22 фев 2013 10:02 Combo fail: floating-point + division by zero var y,n,m,c,e,f:int64;x,p:integer; begin read(n,m,y); for x:=0 to m-1 do begin f:=trunc(exp(ln(x)*n)); if f mod m = y then inc(p); end; If p=0 then write ('-1'); for x:=0 to m-1 do begin f:=round(exp(ln(x)*n)); if f mod m = y then write (x,' '); end; end. WHY???? |
| IF YOU HAVE TLE #6 | Grigor Gevorgian | 1008. Кодирование изображений | 22 фев 2013 09:00 | 4 |
test 6 is something like this: 1 1 . answer: 1 1 1 I got TLE 15 times beacuse of this test! hi,friend how to get the damn test data i TLE on test 1 many time Thank you!! You've saved me. :) |
| if you have WA33 | Giorgi Giglemiani [Freeuni] | 1927. Магия и садоводство | 22 фев 2013 08:37 | 1 |
check your solution for this case: 0 0 1 0 0 1 1 1 answer is -1. |
| python3.3 Time limit exceeded 9th test | Exxtay | 1001. Обратный корень | 22 фев 2013 05:24 | 2 |
How to optimize my code? I know there is a lot of convertions from one type to another. How to avoid it? Or problem of speed not in convertions? import sys, re, math str1 = str(sys.stdin.readlines()) Data = re.findall('\\b\\d+\\b', str1) for i in reversed (Data): print('%.4f' % math.sqrt(float(i))) Edited by author 19.02.2013 23:58 solution, which worktime is 1.85 import sys, re from math import sqrt as sq def find_numbers(f): for line in f: for word in line.split(): if word.isdigit(): yield float(word) lst = list(find_numbers(sys.stdin)) lst.reverse() for x in lst: print('%.4f' % sq(x)) |
| Restricted function | Necron | | 22 фев 2013 03:05 | 1 |
I send my solution for problem 1837 in Java and got this. I used in my program Collections.sort, sun.misc.Queue, HashMap. Can anyone help me? |
| Mathmatical solution | 198808xc | 1874. Футбольные ворота | 21 фев 2013 04:25 | 8 |
From the sample test and the test on board (a = 10000 and b = 1), I have worked out the solution by guessing, and ACed online. For input a and b, the solution is: (a ^ 2 + b ^ 2) / 4 + Sqrt(2) * a * b / 2 However, I could not find the proof for this. Any help or suggestion for me? Write your e-mail. I will help you. S = F(alfa, betta), where alfa is angle of stick a, and betta is angle of stick b. It it requirement for extremum of such function that both partial derivatives (dS/dalfa and dS/dbetta) is zeros. From these two equations you could find that angle between a and b is constant, regardless of their lengthes. Using new formula and getting it's derivative, it's quite simple to show that length from zero point to touching point between stick and tree and length between zero point and touching point between 2nd stick and ground is equal. Also we know hypotenuse of this rectangular isosceles triangle because we know a, b and angle between. S = sum of S of two totaly determined triangles and it is exactly the formula you wrote. Edited by author 30.01.2012 14:21 Thanks so much, to both Neofit and Anatoly. I have followed the ideas of Anatoly, and finished the proof. This is really a good geometric problem! Anatoly, could you explain how sticks should been placed in task example? I even couldn't imagine how to place 2 sticks to get total square more than 4 (rectangle). // S(x, a, b) + x * x / 4 max. // sqrt((x + a + b) * (x + a - b) * (x + b - a) * (a + b - x)) + x * x // 2*x + 1/2 * (-2x * (x * x - (a-b) * (a-b)) + 2x * (-x * x + (a+b) * (a+b))) / sqrt(...) = 0 // 2*x + (-x * (x * x - (a-b) * (a-b)) + x * (-x * x + (a+b) * (a+b))) / sqrt(...) = 0 // delete x // 2 + (2*(a*a + b*b) - 2*x*x) / sqrt(...) = 0 // 1 + ((a*a + b*b) - x * x) / sqrt(...) = 0 // x^2 - (a^2 + b^2) = sqrt(...) // (x^2 - (a^2 + b^2)) ^ 2 = (x ^ 2 - (a - b) ^ 2) * ((a + b) ^ 2 - x ^ 2) // y = x^2 // (a*a + b*b))^2 - 2*(a*a + b*b) * y + y*y = -y*y + (2*(a*a + b*b)) * y - (a*a - b*b) ^ 2 // 2*y*y - 4*(a*a + b*b)*y + 2*(a^4 + b^4) = 0 // y^2 - 2(a^2 + b^2)y + (a^4 + b^4) = 0 // D/2 = 2(ab)^2 // y = (a^2+b^2 (+-) ab*sqrt(2)) // Smax = (2y - (a^2+b^2)) / 4 = (a^2+b^2)/4 + ab/sqrt(2) printf("%.18lf\n", (a * a + b * b) / 4 + (a * b) / sqrt(2.0));
it's the part of my solution and explanation of this formula. My solution and explanation gets about 5-7 lines of text :)It's so easy Can you post the mathematical explanation of your solution? |
| Mathematics behind the scene (proof) | KNIGHT0X300 | 1874. Футбольные ворота | 21 фев 2013 04:22 | 2 |
It is very tempting to start solving using angles. But I would advice you to start with distances from the origin along x and y directions (say x and y). Following steps should easily guide you to the answer. 1) Area = 1/2*(xy+ ab Sin(ArcCos([a^2+b^2-x^2-y^2]/[2ab]))) 2) Using partial derivatives show x=y 3) substitute x=y in area and using first derivative of area show that x^2= [a^2+b^2+sqrt(2)ab]/2 4) Substituting y=x and the result from (3) Area =[a^2+b^2]/4 + ab/sqrt(2) Edited by author 08.02.2013 15:38 1)I can compute the partial derivative of the area function. How do you prove that x=y 2)I can compute the derivative of the area function with x=y but how do you prove that x^2= [a^2+b^2+sqrt(2)ab]/2 |
| Python3.3 Runtime error | Exxtay | 1877. Велосипедные коды | 20 фев 2013 21:48 | 2 |
code1, code2 = [int(x) for x in input().split()] if not (int(code1) % 2) or (int(code2) % 2): print("yes") else: print("no") #What's wrong? in this task i should use: code1 = input() code2 = input() except of: code1, code2 = [int(x) for x in input().split()] |
| 0.001 sec? How? | efpies [SPbSETU] | 1293. Эния | 20 фев 2013 00:38 | 3 |
Now it is impossible because of other compilator and type of compilation. |
| WA#17 | Oracle[Lviv NU] | 1511. Налоговые операции | 19 фев 2013 18:12 | 2 |
WA#17 Oracle[Lviv NU] 25 авг 2010 19:54 This test helped me with WA#17: 5 5 1 right answer is 9 Some more tests, just in case 123 554 340 >10 123 554 300 >9 23 554 300 >8 1515 1414 3424 >10 9 9 100 >-1 19 9 100 >16 1 1 18 >16 |
| WA18 | fatalisPM | 1435. Финансовая ошибка | 19 фев 2013 00:32 | 1 |
WA18 fatalisPM 19 фев 2013 00:32 What 's special in 18'th test? |
| Need help with VB.NET 2010 | Dengin Roman | 1000. A+B Problem | 18 фев 2013 21:16 | 1 |
Hallo. I have already solved this problem, but I want try to do it on different languages. So I need help with VB.NET 2010. Explain me, please, how I should read the input data. |
| WA 8 | orbby | 1900. Машина счастья | 18 фев 2013 17:38 | 1 |
WA 8 orbby 18 фев 2013 17:38 |
| Где ошибка? | Alexey | 1567. SMS-спам | 18 фев 2013 13:40 | 1 |
Компилирую на компьютере, все нормально. Но на проверке ломается на первом же тесте. #include <stdio.h> #include <conio.h> main() { char A[999]; int i=0, s=0, n=0; for (i=0;i<=999;i++) { A[i]='\n'; } while (s!=1) { scanf("%c", &A[i]); if (A[i]=='\n') {s=1; n=i;} i++; } s=0; for (i=0;i<=n;i++) { switch (A[i]) { case 'c': case 'f': case 'i': case 'l': case 'o': case 'r': case 'u': case 'x': case '!': s=s+3; break; case 'b': case 'e': case 'h': case 'k': case 'n': case 'q': case 't': case 'w': case 'z': case ',': s=s+2 ; break; case 'a': case 'd': case 'g': case 'j': case 'm': case 'p': case 's': case 'v': case 'y': case '.': case ' ': s=s+1 ; break; } } printf ("%d", s); } |
| WHY WA at test 3? | SPIRiT | 1096. Таблички с номерами маршрутов | 17 фев 2013 20:05 | 3 |
I used Djkstra search. Why didn't this work? By the way, is 1<=K<=1000 or K may become zero or negative? What's wrong? Can anyone give me a test The k can't be negative, it means the number of the plat. |
| What am I missing ? | _Ioone_ | 1008. Кодирование изображений | 17 фев 2013 11:56 | 5 |
Sample Input: Sample Output: 6 2 3 2 3 RT, 2 4 RT, 3 3 , 3 4 B, 4 2 , 4 3 . I just wonder why there is only one comma on the end. It seems that there should be two - first for squere "4 2" and second squere "3 4". So my question is what does this last comma referrs to ? And obvious - why the other comma isn't in the output ? Thank You. Mike Read correct the task !! There you can see that then last line contains '.' not ',' ! Point ends last line of input. Last line is NOT ONLY POINT! Last line may be the following: RT. POINT using at the last line instead of comma. well i think it must be '.' at last.. because if it can go on .. it will print R L T B .. when print '.' it means at this time it can't go ... |