Common Boarda is the number of NO ; b is the number of YES ans=a/n+(n-1)*(a/n)*(b/(n-1))+(n-1)*(b/n)*(a/(n-1)) =a/n+2ab/n =a*(1+2b)/n O(W*H) solution passes Edited by author 22.08.2021 13:50 Edited by author 22.08.2021 13:50 "чтобы любой отрезок пути длиной k километров пробегать ровно за h часов." Если ЛЮБОЙ отрезок длины к он пробегает за h, то разве из этого не следует, что скорость постоянна? Ну бежал от 99% пути со скоростью света А оставшийся 1% пути пробежал с такой скоростью (очень медленно пробежал) , чтобы получить суммарное время h часов Странность здесь в другом: какой может быть максимум времени, если не оговорены ограничения на траекторию поездки ?! Он ведь может кататься зигзагами, потерять в дороге паспорт и прочесывать тундру в его поисках, и т.п. Максимум равен бесконечности ! Edited by author 27.09.2018 01:21 Полностью согласен. Условие задачи явно кривое. Скорость оленей не ограничена, т.е. они могут хоть телепортироваться считай Здесь факт лишь в том, что они должны пробежать за H часов K километров По этому минимальное например при данных 30 11 2 будет равно 4 Объясняю: За 4 часа олени пробегут 22 км (ну, 11*2 просто) , и так как осталось 8 км, то они могут это расстояние просто перелететь (телепортнуться), ведь это меньше 11 км, поэтому им и время не нужно (они же не прошли 11, значит и 2 часа не нужно). А с максимальным все очень просто, это просто время если бы олени двигались с постоянной скоростью, но могли немного перебежать нужное расстояние(главное чтобы оно было не больше к) При 30 11 2 макс время будет 6 часов, тк только тогда олени достигнут своих 30км изначальных (ну немного больше пробегут - 33 км) Надеюсь кому-то поможет в решение Спасибо) The problem is just from Russia. Pay attention, the Chukchi is running, not an Eskimo, not an Indian, but a Chukchi. And in Russia everything is relative. And the position of the Chukchi is relative. That is, the Chukchi is located somewhere in the Yamal-Nenets district. On the territory within a radius of 100 kilometers from the telephone tower. In 2 hours he will be in an area within a radius of 100 kilometers from another telephone tower. That is, he will reach Moscow in 4 hours, plus or minus 2 hours. Something like this. Translation problems. Что-то ваши объяснения не очень логичны. Вы уверены, что именно эта логика заложена авторами задачи ? use the formula sqrt(abs(x1 - x2)**2 + abs(y1 - y2)**2) not abs(x1 - x2) + abs(y1 - y2) Please give me some tests! (Please forgive me for my poor English.) First,use Hash to record ai Then,enumerate i,j as the first and the second items in the arithmetic sequence.check if 2*a[i]-a[j] exists.If it exists,we stop it immediately because the arithmetic sequence has been found.Otherwise,we find the arithmetic as brute force and mark the longest arithmetic sequence. At last,it's easy to restore the arithmetic sequence. So we can solve it in O(n^2). Edited by author 20.08.2021 13:43 Give some tests, please I hope, the following will help. I've found it using a random generator and a brute force checker. 7 2 -5 -4 -1 -1 -5 5 Answer: 13 In this problem, all the operations should be done on the SAME computer, but I could NOT understand this from the statement, until I read the forum. This problem is quite easy: simple bruteforce could AC in short time, but I think this bug in statement have made this problem SEEMS hard (only 100+ ACed now). Please, fix it. I think you can do on every computers.But doing on the same computer is the best solution. Maybe. Sorry my bad English.:) Damn, i used min(xa, xb) <= x_h <= max(xa, xb) and got WA5, then I wrote min(xa, xb) <= x_h && x_h <= max(xa, xb) and got AC Similar to page scheduling. Used two sets to simulate the process. :) Getting WA #9. My solution is bruteforce after dividing the lines give me some tests thanks. INPUT 1 2 1 0 1 1 0 1 0 OUTPUT 0 is correct? My AC program says 0 is correct!) The problem can be solved using brute force solution Make difference array, where dif[i] = i - a[i] Try 7 10 1 2 1 3 1 4 5 6 5 7 8 9 8 10 8 11 12 13 12 14 This test changed my solution totally. Hope it helps you:) Can the mouse go under the furniture? I mean, can it's way cross the polygons? I didn't solve it. But I think mouse CAN'T cross the polygon. If i think that mouse can go under furniture get WA3. If can't, get WA10 at the moment. So probably mouse can't go under furniture. I think it can't. I got WA3 if it can go under the furniture. But I got AC if it can't. Sorry,my English is very bad. Actually, you can solve it as a graph problem, where numbers 0, 1, ..., n are vertices, which connected like: 0-1, 1-2, ... |
|