Show all threads Hide all threads Show all messages Hide all messages | Anybody give me some tests please! | Landsknecht | 1602. Elevator | 8 Sep 2022 15:45 | 4 | The more - the better! 'cause I have no idea what I'm doing wrong :\ 50 49 8.4 5.5 //1 50 49 8.4 5 //25 50 49 8.4 4 //28 50 49 8.4 2.0 //37 50 49 8.4 0.2 //48 The answer of second test case is 1, not 25. My ac programm gives 1 for second and 25 for third test | To admins: please specify precision | Fyodor Menshikov | 1602. Elevator | 1 Sep 2018 23:15 | 1 | Current tests contain max 2 digits after decimal point. Could you specify it in the problem statement? Else there is no solution to this problem. Without this limit specified a test can have a lot of digits after decimal point so that it is even impossible to read it within time limit. | about wa2 | Gleb | 1602. Elevator | 11 Aug 2018 18:08 | 1 | in this test Petr should go to 1 floor | The problem is magic | Mahilewets | 1602. Elevator | 31 Jul 2017 11:24 | 1 | The problem is very simple. It is clear from the first glance what is going on. The coding is trivial. The math part is trivial. And... for some reason it is almost impossible to get AC from the first try. | WA#3 | † SiriuS † [TWYT Union] | 1602. Elevator | 23 May 2016 14:06 | 4 | WA#3 † SiriuS † [TWYT Union] 13 Mar 2014 15:47 UP! Can someone explain why it happened? import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Lift { public static final float LIFT_DELAY = 15; public static final float PETYA_DELAY = 5; public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(reader.readLine()); float petyaFloor = Float.parseFloat(st.nextToken()); float liftFloor = Float.parseFloat(st.nextToken()); float petyaSpeed = Float.parseFloat(st.nextToken()); float liftSpeed = Float.parseFloat(st.nextToken()); float timeByFootToTheFirstFloor = ((petyaFloor - 1) * petyaSpeed); //время, если идти до 1го этажа пешком float firstLiftDescentTime = ((liftFloor - 1) * liftSpeed) + LIFT_DELAY; //время, затраченное лифтом при спуске и простое на 1м этаже Float numOfFloorToGoByFoot = firstLiftDescentTime / petyaSpeed; //количество этажей, которые может успеть пройти Петя за время спуска лифта int numOfFloors = numOfFloorToGoByFoot.intValue(); //см. предыдущее Float numOfSeekingFloor = petyaFloor - numOfFloors; //искомый этаж float timeLiftWithPetya = (((numOfSearchingFloor - 1) * liftSpeed) * 2) + firstLiftDescentTime + PETYA_DELAY; //время на спуск, подъём к Пете на новый этаж и спуск с ним до 1го этажа if (timeByFootToTheFirstFloor < timeLiftWithPetya) { System.out.println("1"); } else if (timeByFootToTheFirstFloor == timeLiftWithPetya) { String s = numOfSearchingFloor.longValue() + ""; System.out.println(s); } else { String s = numOfSearchingFloor.longValue() + ""; System.out.println(s); } } } Re: WA#3 Oleg Baskakov 23 May 2016 13:38 50 49 0.99 0.28 Answer 21, yours 22. I've rounded up this float, now I get the same answer as you, but it still gives me WA#3 :( Could you please give me one more hint? Edited by author 23.05.2016 14:07 | if you have wa4 | Innokentiy | 1602. Elevator | 10 Aug 2015 17:13 | 1 | check the test where answer is 1 | For those stuck on WA#11 | Linas | 1602. Elevator | 11 Aug 2014 17:44 | 3 | I too did not know what was wrong with my solution, but got accepted when replaced: for (int i = n; i >= 1; i--) if (time[i] < time[besti]) besti = i; with: for (int i = n; i >= 1; i--) if (time[i] + epsilon < time[besti]) besti = i; With epsilon = 1e-9. Good luck! :) Thank you very much. You really helped me: I did the same thing and got AC. for wa7 too work.. thx Edited by author 11.08.2014 17:44 | why this problem has rating 393?? | Aguero | 1602. Elevator | 5 Feb 2013 01:45 | 1 | I think that this problem should be 200.. sry my english is so bad | I need some tests | nmakarov | 1602. Elevator | 26 Oct 2009 01:18 | 2 | Please could you give me some tests for this problem? I have WA11 and don't know what's wrong with it. It's not necessary now, I've got AC long time ago. | WA #4 | kobra | 1602. Elevator | 1 Jun 2009 11:56 | 2 | WA #4 kobra 21 Jun 2008 20:12 #include <stdio.h> int main() { int i,n,k,best; float timeu,timev,time,v,u,A[101],besttime; scanf("%d%d%f%f",&n,&k,&u,&v); for(i=n;i>=1;i--) { timeu=(n-i)*u; timev=(k-1)*v; if(timeu<timev+15) time=timev+15+2*(i-1)*v+5; else if(timeu-timev>15) time=timeu+2*(i-1)*v+5; else time=timev+(timev-timeu)+2*(i-1)*v+5; A[i]=time; } besttime=A[n]; best=n; for(i=n-1;i>0;i--) if(besttime-A[i]>0.00000000001) { besttime=A[i]; best=i; } printf("%d",best); return 0; } Who can give me some tests? i dont know what is incorrect Re: WA #4 Niyaz Nigmatullin {Litsey #2, Kazan} 1 Jun 2009 11:56 I passed this test, when I understood that, if he has to go to the first floor using his legs, he mustn't enter the elevator. So, when calculating time, when he goes to the first floor, you shouldn't add 5 seconds to the time. | Why not double? | Tural Neymanov | 1602. Elevator | 17 Dec 2008 22:32 | 2 | It's interesting that a lot of people here said that we shoudn't use double so I was doing so, and was getting WA#7. I wanted to do a kinda experiment and used double without any hope. however i got AC. I agree, double is all right in case you use comparison like (a+1e-9 < b). | Why WA on 3-th test..C++ ?? | Progress | 1602. Elevator | 7 Nov 2008 05:38 | 2 | #include <iostream> using namespace std; int main() { long double u,v,r; int n,k; cin >> n >> k >> u >> v; r=(((k-1)*v)+15)/u; if(k==1)r=(k*v)/u; if(r+5>n)cout << 1 << endl; else cout << n-(int)r << endl; return 0; } Edited by author 02.06.2008 22:16 Edited by author 02.06.2008 22:17 Oh! I think that you are not right at r. Because the elevator goes down and then waits for 15 minute, after that it goes up. So your fomular computes r is wrong! ^_^. Edited by author 07.11.2008 05:38 | to admins | Tapyshpan Denis | 1602. Elevator | 10 Aug 2008 22:51 | 2 | May be urs test not accurately. I've used DBL_EPSILON from cfloat and I've received "WA#11". When I replace DBL_EPSILON to 1e-9, I've received "accepted". Check urs test once again plz. | WA 7 Whats wrong? | tanas | 1602. Elevator | 6 Jul 2008 02:40 | 2 | This is my program. I have read all forum but didn't find answer. Please help {$Q-,R-,S-,I-,O+} program z1602; uses math; var a: array [1..101] of extended; u, v, k, min: extended; pos, i, n: longint; begin read(n,k,u,v); a[1]:= (n-1)*u; for i := 2 to n do a[i]:= max((n-i)*u,(k-1)*v+15)+(i-1)*v+5+(i-1)*v; min:= a[1]; pos:= 1; for i := 2 to n do if a[i] + 1e-9 < min then begin min:= a[i]; pos:= i; end; writeln(pos); end. read problem more attentively. when you find pos, you way from 2 to N, but right way from N downto 2... and you get AC :) Edited by author 06.07.2008 02:43 | WA #11 | Russtam | 1602. Elevator | 6 Jul 2008 02:25 | 2 | WA #11 Russtam 10 Apr 2008 15:58 What's wrong with my function? long double f(int x) { if (x>1) { long double t; if (((k-1)*v+15)>((n-x)*u)) t=(k-1)*v+15; else t=(n-x)*u; return t+(x-1)*v+5+(x-1)*v; } else { return (n-1)*u; } } People give me some tests. Edited by author 10.04.2008 19:46 Your source is right. But please don't remember that "If there are several equivalent variants, output such one in which Petr will go by foot the smaller distance." | I don't want to use doubles, can u help me? :) | AlMag | 1602. Elevator | 31 May 2008 14:54 | 3 | I have WA#11 and read on previous topics that it must be something in "double", what shall i do? if you compare two doubles use a - b > 0.000000001 instead of a > b The same resul :( I compare two doubles just once | double vs float | yujj | 1602. Elevator | 31 May 2008 03:30 | 2 | I'm use double and got WA#11. But with float i got AC. What wrong with double? Bad tests? When comparing calculate time _t_ to the current _best_ time, where both variables are doubles, use e.g. if (t + 1e-9 < best) | Please, what answer is for n = 99, k = 50, u = 7, v = 3??? | winner1 | 1602. Elevator | 11 Apr 2008 21:09 | 5 | my algo gives 54, but I think it's wrong. Help!!!! You are right, the answer is wrong. Right answer for the input is 76. IMHO 75 is right answer too, isn`t it? Why answer 76? Not it 75? 75 will give the best time! You are wrong, guys! Straightforward checking shows that answer 76 is better than 75. Pay attention that lift and Petya reach FIRST, not zero floor! | why WA #4? | Ras Misha [t4ce] | 1602. Elevator | 29 Mar 2008 14:00 | 1 | i understand what's wrong )) Edited by author 29.03.2008 14:01 Edited by author 29.03.2008 14:20 | Why the answer of example isn't 44? | Tinker | 1602. Elevator | 25 Mar 2008 23:48 | 4 | The man should be at the floor before he call for the elevator. My English is so poor.... I still do not understand. In the example case. If Petr go to floor 45: He take 4.8*5 = 24 second to go to floor 45. The elevator take 0.2*48 + 15 + 0.2*44 = 33.4 seconds to go to floor 1, stop there 15 seconds, and then go up to floor 45. So, Petr must wait for 33.4-24 = 9.4 secs, go in for 5 secs, and go down take 44*0.2 = 8.8 secs The total time is 24 + 9.4 + 5 + 8.8 = 47.2 secs Now compare with Pert go to floor 44: He take 4.8*6 = 28.8 second to go to floor 44. The elevator take 0.2*48 + 15 + 0.2*43 = 33.2 seconds to go to floor 1, stop there 15 seconds, and then go up to floor 44. So, Petr must wait for 33.2-28.8 = 4.4 secs, go in for 5 secs, and go down take 43*0.2 = 8.6 secs The total time is 28.8 + 4.4 + 5 + 8.6 = 46.8 secs! So, go to floor 44 is better, isn't it? Edited: uh oh... I misunderstand the question. The elevator will no go up till Petr press the button of elevator. Sorry. Edited by author 07.03.2008 18:57 I understand too... Edited by author 25.03.2008 23:50 |
|
|