|
|
Please, give me test if anybody have it Please help me, guys, I don't know what's the problem:( #include <iostream> using namespace std; int lft[320], rght[320]; double timeleft[320], timeright[320]; double const eps = 0.0000001; int main(){ int n,m; cin >> n; for(int i = 1; i <= n; i++){ cin >> lft[i]; timeleft[i] = (lft[i] + 5.000)*9/50; } cin >> m; for(int i = 1; i <= m; i++){ cin >> rght[i]; timeright[i] = (rght[i]+5.000)*9/50 - 36.000/25; } double ans = 1000000000; if(lft[1] >= 8 && (rght[1] >= 16 || (rght[1] <= 3 && (rght[2] >= 16 || m == 1)))){ cout << 0; return 0; } for(int i = 1; i <= n; i++){ double cur = timeleft[i]; bool b = 0; if(lft[i+1] - lft[i] >= 13 || lft[i+1] == 0){ for(int j = 1; j <= n; j++){ double temp = rght[j] - (cur + 36.000/25)*200.000/36; if(temp > -5 + eps && temp + eps < 8) b = 1; } } else b = 1; if(!b && cur + eps < ans) ans = cur; } for(int i = 1; i <= m; i++){ double cur = timeright[i]; bool b = 0; if(rght[i+1] - rght[i] >= 13 || rght[i+1] == 0){ for(int j = 1; j <= n; j++){ double temp = lft[j] - cur*200.000/36; if(temp - eps > -5 && temp + eps < 8) b = 1; } } else b = 1; if(!b && cur + eps < ans) ans = cur; } printf("%.9f",ans); return 0; } когда Егор считается сбитым? когда он имеет хотя бы одну точку с автомобилем или же когда он находится строго внутри? другими словами - может ли Егор касаться автомобилей в процессе перемещения? Yes, he may touch the car Did you try to touch moving car, Erop? :) But touching cars we make set of times finite and can use brute force in this set. I can't understand why wa7, can somebody give me test, please? Maybe precision or bad algo? =) I have solved this problem in fractional arithmetic. Edited by author 25.10.2011 03:28 Edited by author 25.10.2011 03:29 Would better to have all time intervals having int left and right points. For it we may use another length units shorter then 1m by 50 times. Edited by author 25.10.2011 08:44 I can't understand why wa7, can somebody give me test, please? 1 8 1 29 0.000000 another test case : 1 1 1 10 ans: 1.260000 Choker Edited by author 23.10.2011 22:23 |
|
|