| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Problem 1279 "Warehouse" has been rejudged | Vladimir Yakovlev (USU) | 1279. Warehouse | 3 апр 2018 12:55 | 3 |
New tests have been added. 95 authors have lost their AC. Wow Such an old problem and still you can add new tests when again rejudge ural 1394 and ural 1589 I belive my programme can be challenged |
| Problem 1493 "One Step from Happiness" has been rejudged | Vladimir Yakovlev (USU) | 1493. В одном шаге от счастья | 3 апр 2018 04:39 | 1 |
New tests have been added. 86 authors have lost their AC. |
| hint:for who tle#17 | Lan Jun | 1373. Pictura ex Machina | 3 апр 2018 03:19 | 2 |
use int instead of double Good Luck to clarify: there is no problem to use doubles for computations, but you must input data as ints and convert it to doubles (10x faster), e.g., using D = double; using V = array<D,2>; V rv(){ int x,y; cin >> x >> y; return V{D(x),D(y)}; } |
| Mathematics Behind the scene | KNIGHT0X300 (Nipuna Samarasekara) | 1436. Рекламный щит | 3 апр 2018 02:04 | 2 |
There exist a closed form for the answer. hence the solution is O(K). and it is easy to find with Maxima: d2(x1,y1,x2,y2):=(x2-x1)^2+(y2-y1)^2; x1: 0; /* even simpler if we assume x1=0 */ a1: d2(x1,y1,x,0); a2: d2(x2,y2,x,0); d: d2(x1,y1,x2,y2); /* the triangle */ ca: (a1+a2-d)/(2*sqrt(a1*a2)); /* cos of the angle */ s:solve(diff(ca,x)=0,x),ratsimp; /* solutions have y2-y1 as the denominator, so */ s1:solve(diff(ca,x)=0,x),y2=y1,ratsimp; /* let us solve it in this special case */ |
| как решать? | C_p | 1001. Обратный корень | 2 апр 2018 19:01 | 9 |
Как определить конец файла? Это точно C++? По моему это или ява или C#... Вот я тоже очень удивляюсь, как решать? Как я определю конец исходных данных? Попробовал залить бесконечный цикл, по времени не проходит... |
| Try to solve the problem WITHOUT floating numbers! | 198808xc | 1875. Angry Birds | 2 апр 2018 18:34 | 3 |
The most important functions are listed below: // Judge if there exist a parabola passing P[a] and P[b] // The validation of direction of the parabola is included in the positive sign bool Valid(int a, int b) { if (P[a].x == P[b].x) return false; else return (P[a].x - P[b].x) * (P[a].x * P[b].y - P[b].x * P[a].y) > 0; } // Judge if the parabola passing P[a] and P[b] also passes P[c] // Using the determinant for judgement bool Pass(int a, int b, int c) { return (P[a].x * P[a].x) * P[b].x * P[c].y + P[a].x * P[b].y * (P[c].x * P[c].x) + P[a].y * (P[b].x * P[b].x) * P[c].x - (P[a].x * P[a].x) * P[b].y * P[c].x - P[a].x * (P[b].x * P[b].x) * P[c].y - P[a].y * P[b].x * (P[c].x * P[c].x) == 0; } Note: using long integers (64-bit) to avoid overflow. Good luck. Do not derive them by hand, use Maxima: p: a*x^2+b*x=y; s: solve([ev(p,x=x1,y=y1),ev(p,x=x2,y=y2)],[a,b])[1]; a < 0,s; m: denom(lhs(ev(p,s,ratsimp))); e: ev(p,s) * m, ratsimp; to print as source code use fortran(e); It is also a good idea to use macro to avoid typos: bool on_par(int a, int b, int c){ // [c] on the same parabola as [a] and [b] # define _(a,b,c) x[c]*x[a]*(x[c]-x[a])*y[b] return _(a,b,c) - _(b,a,c) == _(a,c,b); # undef _ } |
| a less zero! test #4 | Oleg Baskakov | 1875. Angry Birds | 2 апр 2018 18:30 | 3 |
I've got AC then complete test for a<0 && b!=0: 1 999 2 999 3 0 4 1 5 2 answ 3... Good Luck! Edited by author 23.10.2011 01:27 Edited by author 23.10.2011 04:20 This is not correct test =) In russian vertion of problem "В каждой из пяти строк входа находится пара целых положительных(!!!!) чисел, не превосходящих" There are no points with negative x. Use assert to test such things. Test 5 is likely about points that have the same x. |
| What's test 8 case? | OPyshkin | 1666. Про Васю Феррари | 2 апр 2018 01:41 | 1 |
|
| hint | ASK | 1775. Космический боулинг | 1 апр 2018 17:19 | 2 |
hint ASK 1 апр 2018 01:37 For each pair of points, consider the family of lines parallel to the line that connects the points. Project all the points on the line perpendicular to the family, sort the coordinate, and find the smallest coordinate distance that covers k points. Note that since at least one line on the border must contain two points, instead of sorting one can use partition and nth_element. That is the time complexity does not need logarithm: O(n^3). |
| Where can I improve on my Python solution? | kitchent | 1126. Магнитные бури | 1 апр 2018 01:10 | 1 |
EDIT: Finally passed with Python in 0.109s. deque() really works for this problem. The key insight is to recognise how we design the pop() and popleft() to make sure the first element of the list is the largest element which has not expired. Whether or not the middle elements have expired does not matter. Edited by author 01.04.2018 15:32 |
| Please help, i don't understand conditions | yarmet | 1917. Руины титанов: убийственная точность | 31 мар 2018 20:01 | 2 |
Hi. Can anyone help me? 5 4 4 1 4 1 2 Why answer 3 2 ?? why it isn't 3 1? i can cast power = 2, then i'll destroy three coin (1, 1, 2) which is equal to 4, and i can survive. But i can't cast with power 4, because then i take (4,4) = 8 damage.
Edited by author 31.03.2018 04:18 Edited by author 31.03.2018 04:18 Edited by author 31.03.2018 04:20 >If we destroy k coins, the response will be k times stronger than our spell This means, if we destroy 3 coins (1, 1, 2) with power 2, we'll take 3*2=6 damage. |
| HELP WA16 | Alikhan Okas | 1752. Дерево 2 | 31 мар 2018 17:38 | 1 |
|
| Пожалуйста, измените условия задания | Ayrat | 1007. Кодовые слова | 30 мар 2018 21:37 | 1 |
Так до сих пор и не выяснилось, что делать с окончанием ввода? Или измените условия так, чтобы окончание ввода оканчивалось явно - например пустой строкой или -1, или же уточните, нужно ли это делать с помощью файла. Перенаправление ввода из файла, например в bash, не воспринимает символ конца файла EOF. А ваш сайт при тесте делает расчет на то, что ввод окончится EOFом. Думаю по этой проблеме так мало успешных попыток |
| WA 2 | Andris | 1795. Мужья в магазине | 30 мар 2018 10:32 | 1 |
WA 2 Andris 30 мар 2018 10:32 Could anyone give me some tests for this one? |
| Solution | Denis Rozimovschii | 1987. Вложенные отрезки | 29 мар 2018 23:24 | 3 |
Solution Denis Rozimovschii 14 авг 2015 22:02 One of the solutions would involve sorting and stacks. I've tried to use reb-black tree, but it seems to have problems with dublicate-keys. Edited by author 14.08.2015 22:05 I got AC by iterating all the ranges and putting them in a stack. Basically, if next range fits into previous one, put it in a stack. If it does not, remove previous ranges from the stack until it does (or the stack gets empty). At each step, update the answers to relevant queries. Binary search is good enough for finding them. it's possible to solve this problem with segment tree. Just put all answers into segment tree with meaning -1 and then update it with segments, sorted by range |
| Interesting problem | __Andrewy__ | 1481. Шансы на победу | 29 мар 2018 22:44 | 1 |
HINT1: solution always exist HINT2: try to solve this problem with end. HINT3: this problem can solve <= O(n logn) |
| How do we have a stable sort better than the builtin timsort in Python? | kitchent | 1100. Таблица результатов | 29 мар 2018 15:01 | 1 |
I tried implementing mergesort which probably had recursion depth runtime error; bisect insertion to save some memory, but too slow for python list (perhaps a good alternative if I have access to pointer?); heapq is much faster but instable. What are other options? |
| I CAN´T SEE WHAT IS WRONG (JAVA ) | Felix Leonel Chaves | 1001. Обратный корень | 29 мар 2018 01:27 | 2 |
import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.Scanner; public class Reverse { private static void printer(double value){ String pattern = "###0.0000"; DecimalFormat myFormatter = new DecimalFormat(pattern); String output = myFormatter.format(value); System.out.println(output); } public static void main(String[] args) { Scanner sc = new Scanner(new InputStreamReader(System.in)); long a,b,c,d; a = sc.nextLong(); b = sc.nextLong(); c = sc.nextLong(); d = sc.nextLong(); printer(Math.sqrt(d)); printer(Math.sqrt(c)); printer(Math.sqrt(b)); printer(Math.sqrt(a)); } } In your solution, it is possible just 4 numbers (a,b,c,d). Suggestion: try using a loop instead of a,b,c,d and finish the loop when the user type something different than a number |
| It's very easy problem | [BSU] nzamulov | 1336. Проблема Бен Бецалеля | 28 мар 2018 04:43 | 6 |
It's very easy problem, but many people don't understand how to solve it ... :) 7 lines : #include <iostream> using namespace std; int main(){ unsigned long long N; cin >> N; cout << N*N << endl << N; return 0; } 5 lines: #include <iostream> void main() { unsigned long long N; std::cin >> N; std::cout << N*N << std::endl << N; } 4 lines: public class solver { public static void main(String[] args) { long n = new java.util.Scanner(System.in).nextInt(); System.out.println(n*n + "\n"+n);}} var n:int64; begin read(n); writeln(n*n); write(n) end. Edited by author 06.10.2014 22:49 OMG, i made prime factorization of n, searching for odd powers, multiplying to get k got AC, but now I see it was not neccassary Also for 18 i got 12 and 2, as in example. Edited by author 27.11.2015 02:00 1 line, no ";" tricks to put multiple lines into one :) print (lambda x : str(int(x) * int(x)) + '\n' + x)(raw_input()) |
| Who knows test 6? | Михаил | 1966. Велодорожки | 27 мар 2018 16:10 | 1 |
|