| Show all threads Hide all threads Show all messages Hide all messages |
| F. British scientists save the world | cplayer | 1925. British Scientists Save the World | 24 Mar 2016 02:00 | 8 |
Why the 2nd sample's answer is Big Bang? But why realy? I cant understand and could you please explain the first test too? Because the expected sum is 4+3-2*2(sum of the numbers shown on the screen+k-(n+1)*2) while the real sum is 6+x(the sum of the inputed numbers+the number YOU have to input), but they have to be equal: 4+3-2*2=6+x 7-4=6+x x=-3, but the answer is non-negative, so it is "Big Bang!". (in first sample you have 3+3+5+6+5+7+5-7*2 as the expected sum, and 1+1+3+5+5+2+x as the real sum: 3+3+5+6+5+7+5-7*2=1+1+3+5+5+2+x 34-14=17+x x=20-17 x=3 ) X is the output number. Or at least that is how i understood this problem. edit: what is the limit of X??? Edited by author 27.10.2012 15:43 You answer is kick ass. How can you figure out something like that? I check again and again, and it seems gibberish to me. I don't understand (n+1)*2. Can you tell me Why do you subtract (n+1)*2; Cause we subtracted 2 n+1 times |
| For coders who got Runtime Error | IlushaMax | 1496. Spammer | 24 Mar 2016 00:56 | 1 |
Just read it Runtime error. Программа аварийно завершила работу. Возможные причины: ненулевой код возврата (ошибка «non-zero exit code»); деление на ноль (ошибка «division by zero»); бесконечная рекурсия (ошибка «stack overflow»); недостаточный размер массивов или обращение по недоступному адресу в памяти (ошибка «access violation»). Чтобы избежать переполнения стека, используйте специальные директивы, которые приведены в разделах, посвященных конкретным языкам программирования. I've read and understood where my mistake is. Edited by author 24.03.2016 00:57 |
| Strange Testcases. Please Help! | Dev | 1607. Taxi | 23 Mar 2016 10:53 | 3 |
for 150 400 1000 200: 150 1000 550 800* 950 600 how is the answer 800 and not 950 ?? for 100 100 150 20: 100 150* 200 130 why is the answer 150 and not 200 ?? for 1 2 12 3: 1 12 3 9 5 6* 7 5 why is the answer 6 and not 7 ?? for 3 3 5 2: 3 5* 6 3 why is the answer 5 and not 6 ?? Please help! Edited by author 16.03.2015 23:24 Read one more time the problem and thank you for good tests) "Таксист не станет называть цену ниже той, которую предложит Петя. В этом случае он согласится с его ценой. Аналогичным образом поступит и Петя." |
| Hint | Batyr Nuryyev | 1001. Reverse Root | 23 Mar 2016 00:16 | 1 |
Hint Batyr Nuryyev 23 Mar 2016 00:16 USE while(cin >> number), DO NOT USE cin.eof() |
| I've got WA #7. Can someone give me test #7 please??? | esekkelle | 1901. Space Elevators | 22 Mar 2016 22:42 | 3 |
Had the same problem at the beginning, but finally solved it. Good test that helped me to find a bug in my algorithm was: 3 6 2 1 5 When the solution is: 2 (not 3) 2 5 1 Edited by author 24.03.2014 16:32 Edited by author 24.03.2014 16:33 Why two? need to output the maximum amount of trips of the elevator. I dont understand it. |
| Pascal:Correct Answer for new | IlushaMax | 1001. Reverse Root | 22 Mar 2016 15:26 | 3 |
var a:array [1..200000] of int64; n,i: integer; begin {$IFNDEF ONLINE_JUDGE} {$ENDIF} while not seekeof do begin inc(i); read(a[i]); end; for n:=i downto 1 do begin writeln(sqrt(a[n]):4:4); end; {$IFNDEF ONLINE_JUDGE} {$ENDIF} end. |
| Hahaha | IlushaMax | 1349. Farm | 22 Mar 2016 01:52 | 1 |
Hahaha IlushaMax 22 Mar 2016 01:52 See on hint in author of the problem. One more hint: Use wiki if you know nothing about Mr. Pierre Edited by author 22.03.2016 02:06 |
| There's a problem with test case 7..This is my program | ANKUR SAKHALA | 1131. Copying | 21 Mar 2016 15:46 | 1 |
#include<stdio.h> int main() {float n,k,count=0; float m; int i=1; scanf("%f %f\n",&n,&k); n=n-1; while(n>0) {n=n-i; count++; i=i*2; if(i>=k) {m=n/k; i=m; if((m-i)>0) count=count+i+1; else count=count+i; n=0; } } i=count; printf("%d",i); return 0; } |
| Got AC in O(|E|)!!!!! | cena | 1106. Two Teams | 20 Mar 2016 20:52 | 2 |
Is there any better solution? No. This is the lower bound, since you have to read the edges anyways. |
| Brute force;-) | Katy | 1126. Magnetic Storms | 20 Mar 2016 19:04 | 5 |
I know that this problem could be solved using sorting and something like that - my friends do so but don't share code, I don't know how. I used brute force (= the easiest way) and i got AC 0.281 330 KB at C++ You can use structure Heap or Interval Tree ( because the value of the elements is rather small ). Heap : O(NlogM) Interval tree : O(N log(Max_Value) ). Interval tree also can give you the k-th smallest value in log (Max_value). I know that this problem could be solved using sorting and something like that - my friends do so but don't share code, I don't know how. I used brute force (= the easiest way) and i got AC 0.281 330 KB at C++ Yes... and with little bit of optimization, one can get AC in half of that time... :) Edited by author 20.03.2016 19:06 |
| Hint | Jane Soboleva (SumNU) | 2070. Interesting Numbers | 20 Mar 2016 15:53 | 8 |
Hint Jane Soboleva (SumNU) 22 Oct 2015 02:04 Re: Hint Mikhail Krivenko 22 Oct 2015 02:23 I implemented that but I have WA 5. What's in this test? Re: Hint Jane Soboleva (SumNU) 22 Oct 2015 14:51 I don't know, maybe double check if your numbers are exactly in range of [a, b]? And if they're long, not int? I implemented it too, but still have WA 27... Please, help me found a bug... What's wrong here: -- Thanks in advance. Edited by author 19.03.2016 19:43 Edited by author 20.03.2016 15:53 Re: Hint Jane Soboleva (SumNU) 20 Mar 2016 01:33 For max test, your answer ends in 3. But it's actually 8. Can you give the right answer on that test? Re: Hint Jane Soboleva (SumNU) 20 Mar 2016 15:15 Uh, i just did? I guess i didn't make it clear enough. Anyways, there you go. 2 1000000000000 999999921288 UPD: it's fine, and congrats~ Edited by author 20.03.2016 16:06 Sorry for bother, I just wanted to clarify. :) Now I corrected a mistake and got AC. |
| if you have WA # 15 try this test cases | Adhambek | 1755. Cake | 19 Mar 2016 17:06 | 2 |
input 1: 1 2 0 1 10 10 output 1: 10 5 input 2: 1 2 1 0 10 10 output 2: 5 10 input 3: 1 2 0 0 10 10 output 3: 10 10 Edited by author 17.12.2015 10:39 Thank you And it's really strange that in these three cases if I output 0 5 5 0 0 0 I will get a WA...., if I output the another answers I will get AC... why? |
| WA 21 | Stas | 1261. Tips | 19 Mar 2016 13:35 | 1 |
WA 21 Stas 19 Mar 2016 13:35 What is number N = ? and what to output? |
| Very good AC - 0.281 sec and 850K | 12345 | 1316. Electronic Auction | 19 Mar 2016 12:05 | 8 |
My program uses only 850K of memory!!! Two days of troubles and the best solution was written! If you are intrested in it leave your mail here. I've solved this problem via interval tree, but it uses 4 Mbytes. I don't need your code, but could you explain your algorithm? My e-mail is dimanyes@yahoo.com I think, that he have used Fenwick tree No :) This solution uses Cartesian tree. My best solution which uses Fenwick's tree uses about 1400K of memory PS: Good luck on the ROI, Ilya :) Can you say book's names where these tree are described? I've modified this solution... Now it uses only 630K of memory!!! (Random Trees are very useful :) can i do it without trees ? like this #include<iostream> #include<string> using namespace std; void limit_to_two_num(float &price) { price=price*100; price=static_cast<int>(price); price=(price)/100; } void main() { int check=0,quantity,length=0; string str="\0"; float price; float profit=0; float arr[100000]; while(str!="QUIT" && check!=100000) { cin>>str; if(str=="BID") { cin>>price; limit_to_two_num(price); arr[length++]=price; check++; } else if(str=="DEL") { cin>>price; limit_to_two_num(price); for(int i=0;i<length;i++) { if(arr[i]==price) { for(int j=i;j<length-1;j++) { arr[j]=arr[j+1]; } length--; break; } } check++; } else if(str=="SALE") { cin>>price; limit_to_two_num(price); cin>>quantity; for(int i=0;i<length;i++) { if(arr[i]>=price) { profit=profit+0.01; } } } } cout<<"Total profit: "<<profit<<endl; } i can't solve this problem.Please help... yu1178209138@hotmail.com |
| Strange Aeroplane | IlushaMax | 1893. A380 | 19 Mar 2016 01:25 | 1 |
window | ******| window window?|****|window? The distance between window and last chairs is 1 chair but it's there! Windows can be only in Business and Econom cause these parts are in different decks. |
| Why access violation(pascal)? | IT | 1563. Bayan | 18 Mar 2016 22:23 | 1 |
Edited by author 22.03.2016 20:56 Edited by author 22.03.2016 20:56 |
| Выдает ошибку "Runtime error 1" | Artem Alieinikov | 1005. Stone Pile | 18 Mar 2016 14:41 | 2 |
Можете обьяснить пожалуйста что я делаю не так? Я ходил по обсуждению задачи пробывал тесты которые предлагают, результаты вроде бы как правильные. Может я неправильно организовал ввод/вывод данных? Работает как-то так. Считываю в 1 строку: 6 1 4 5 6 7 9 Очищаю консоль и вывожу Console.WriteLine ответ: 0 There are 2 (TWO) lines in the sample. First contains count of stones, second contains stones weights. Your test should look like: --- 6 1 4 5 6 7 9 --- By the way some languages (C scanf/C++ iostream/Java scanners) allow reading from input without checking how data items are placed on input lines. Here - http://acm.timus.ru/help.aspx?topic=csharp - input read in similar way via string[] input = Console.In.ReadToEnd().Split( new char[] {' ', '\t', '\n', '\r'}, StringSplitOptions.RemoveEmptyEntries); |
| what is the so-called initial step for 2 eggs / 20 floors? | esbybb | 1223. Chernobyl’ Eagle on a Roof | 18 Mar 2016 03:06 | 10 |
spot check shows me that it should be 7 am i right? then the answer is 8 moves?? EGGS=2, FLOORS=20 (20 eggs, initial step = 7) e=20(20) 7 14 17 18 19 e=19(20) 7 14 17 18 19 (+7, +3) ...(e=18..14 ) e=13(20) 7 14 8 9 10 11 12 13 [7 moves] (20 eggs, initial step = 7) (20 eggs, initial step = 6) e=5(20) 6 1 2 3 4 5 e=17(20) 6 12 18 13 14 15 16 17 [8 moves] (20 eggs, initial step = 5) e=20(20) 5 10 15 18 19 20 e=17(20) 5 10 15 18 16 17 e=14(20) 5 10 15 11 12 13 14
(20 eggs, initial step = 4) 4 8 12 16 20 17 18 .. thanks! also what is the algorithm for this particular test case? thanks or maybe step is not fixed at all? like step0=7, step1=6, step2=5? +6 +5 +4 +3 6 11 15 18 5 6 1 2 3 4 5 10(or 11) 6 11 7 8 9 10 14(or 15) 6 11 15 12 13 14 17(or 18) 6 11 15 18 16 17 20 6 11 15 18 19 20 hmm for 2 eggs / 20 floors the answer is 6, this is weird Edited by author 16.03.2016 05:21 2eggs 100floors (14) +14 +13 +12 +11 +10 +9 +8 +7 14 27 39 41 52 62 71 80 88 95 39 14 27 39 28 29 30 31 32 33 34 35 36 37 38 100 14 27 39 41 52 62 71 80 88 95 96 97 98 99 IIRC for this task we need to save the last egg at all costs, until the moment we figure out the exact answer. For 2 eggs / 20 floors, that would be: 1st try: 6, and if breaks — 1, 2, 3, 4, 5 in worst case for last egg (so it breaks when we figure out the answer for sure). 2nd: 11, if breaks — 7, 8, 9, 10. 3rd: 14, if breaks — 11, 12, 13. 4th: 17, if breaks — 15, 16 5th: 19, if breaks — 18. 6th: 20 So in worst case, 6 tries. Then again, i didn't solve it yet, so i can't guarantee anything, but that's how i understood it from previous discussions. And yeah, you already described it above, i didn't read. Sorry. Edited by author 16.03.2016 06:26 the direction is right, step0 is the answer, for 2 eggs dunno for 3 eggs also coz i не решил еще тоже Well, intuitively, with 3 eggs we should put the first one in the middle, to minimize a floor quantity in worst case for remaining two eggs? intuitively this is DP problem with precomputing table of 1001x1001 cells row 1 contain values -1 1 2 3 4 5 .. row 2 contain values -1 1 2 2 3 3 .. row 3 ?? with 3 eggs we do move0 somewhere in the middle, doing loop from Eggs to 1, computing min(row1[step1]+row2[step22]) (or minimize step1+step2, maybe) for 3 eggs: for (step2=e; step2>1; step2--) for (step1=i2; step1>1; step1--) row 2 : -1 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 .. |
| WA 9 | Justine Tsiga | 1435. Financial Error | 17 Mar 2016 22:05 | 1 |
WA 9 Justine Tsiga 17 Mar 2016 22:05 Can you give me some examples, please! |
| how to make it right? | Bartenal | 2056. Scholarship | 17 Mar 2016 15:35 | 1 |
n=int(input()) l=[int(input()) for _ in range(n)] items=sum(l) n=float(n) x=3.0 for i in l: try: i==x print ('None') if items/n==5 and i!=x: print 'Named'
elif (4.5<=(items/n)<5)and i!=x: print 'High'
elif ((items/n)<4.5)and i!=x: print 'Common' |