| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| To Admins: Weak tests | Dmi3Molodov | 1242. Оборотень | 13 июн 2026 01:51 | 1 |
1) write in the assignment that family ties and victims cannot be repeated in the input, or add such tests. this is a real problem when searching for maniacs in databases. 2) write in the assignment that a werewolf cannot kill himself. |
| Please add this test. | Zayakin A. [Perm SU] | 1202. Путешествие по прямоугольникам | 12 июн 2026 06:57 | 2 |
#include <cstdio> int main() { freopen("output.txt", "w", stdout); printf("99999\n"); printf("0 0 10 100\n"); for(int i =0 ; i < 99998; ++i) { printf("%d %d %d %d\n", (i+1)*10,0,(i+2)*10 , 100); } return 0; } My early solution get AC, but must get TL. Edited by author 19.01.2011 16:05 Also this test 4 0 0 2 6 2 2 4 4 4 0 6 6 6 2 8 4 My AC solution gives 12 when correct answer is 8 |
| What is the answer for... | Nazar (Lviv NU) | 1202. Путешествие по прямоугольникам | 12 июн 2026 06:57 | 4 |
What is the answer for 2 0 0 3 3 3 2 5 7 Answer is -1? Yes (-) Michael_Rybak 15 фев 2006 18:29 What?! Why? ^ | __ | | | | | | | | | |___| | Such input gives that picture, so why there is no path?! | | | | |__| |___| ----------- > Your picture has 3,1 for lower-left corner of second rectangle |
| Why this taks can not be solved with Trie? :@@ | mes | 1414. Астрономическая база данных | 12 июн 2026 00:26 | 6 |
It's just brute-force task :) There 36 lines in my AC code versus yours 165 lines :) Edited by author 08.03.2013 19:59 thanks, now AC with set :/ It can actually be solved with trie. My solution uses 0.4s (cin) and 20MB. Just store a map in every node. Solved with C++ with tree of static arrays of links, without any STL structures Same here. 0.062 sec, 1.8Mb |
| Some tests | andreyDagger`~ | 1998. Старый падаван | 11 июн 2026 23:09 | 3 |
5 3 1 2 2 2 2 2 3 4 6 ans: 11 5 3 3 1 2 3 4 5 1 4 7 ans: 12 9 9 123 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ans: 9 Why does the last test have an answer 9? on 9th second he can't pick up the last stone, instead he drops all of them, so isn't the answer 27? |
| WA on test 6 in C++ | Mamuka Sakhelashvili [Freeuni] | 1316. Биржа | 11 июн 2026 22:45 | 5 |
I have solved this problem by Fenvic tree, at first I got WA on 5 test, then I changed int-s into long long-s and now I have WA on 6 test. If you had this kind of experience please tell me what types should I use to get AC? Thanks. The test 6 aint about data types' ranges. იდეაში, ეგ ხო ფენვიკის ხით უნდა გავიდეს, მე ვთვლი რაოდენობას, რამდენი გაყიდვა შესრულდება და შემდეგ ვამრავლებ 0.01–ზე და ვაბეჭდინებ. და ეგრე უნდა მუშაობდეს წესით ხო? Try this test BID 0.01 SALE 0.02 10 Answer:0.00 |
| Is there better solution then O(n^3) for each test? | vgu | 1221. Malevich Strikes Back! | 11 июн 2026 21:35 | 5 |
How I can do it on 0.001? Edited by author 31.10.2008 02:29 Edited by author 16.06.2009 00:42 I track w0[i][j] as length of longest horizontal stride of a[i][j]==0 starting at i,j (0 if a[i][j]==1), symmetric for w1[i][j]. Now w1[i][j] defines the length to be tested (as 2*w[i][j]+1), this is done by descending downwards. At first it seems to be O(N^3) but due to nature of the pattern you won't descend all that frequently, so I believe it's O(N^2), and it gave 0.001 AC in C++ |
| Problem description | LaVuna [KHNURE] | 1221. Malevich Strikes Back! | 11 июн 2026 21:17 | 2 |
You should find maximum matrix which is square, black and also contains white square inside rotated by 45 degrees. For instance: 1) 1 1 1 0 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 0 1 1 1 2) 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 are desired matrices maximum width of which you must find 1st matrix is invalid (pre-last row) |
| Can we do this in O(N) ? | Nikunj Banka | 1031. Железнодорожные билеты | 10 июн 2026 11:52 | 5 |
My solution runs in O(N logN) and it uses heap data structure. The discussion forums hint that there may be a O(N) time solution. Is there a linear time algorithm? heap?:D just use lower_bound And, BTW, Yes there is. At first I used Binary Search on each station but on the next station you can start with the previous index. code: int canReach1 = A[i] + L1; while (ind1 <= end && A[ind1] <= canReach1) ind1 ++; i've used dp (which is easy to notice) with some optimization. suppose we have three stations s1 s2 s3 and there exists path s1-s2 covered with l1, and path s1-s3 also covered with l1. then we can skip the analysis from s2. we can easily reduce used time if we create list of "allowed" stations to analyze (like s3) You can keep deque (FIFO) of pairs (max_x,total_price) if using C1 on last trip, same for C2, same for C3. All three deques will be non-descending on price (and naturally ascending on coordinate). At each step pick minimum from non-empty deques (their front element) and push new advances to their end. Edited by author 11.06.2026 06:16 |
| WA#11 | gepo | 1291. Шестерёнки | 10 июн 2026 04:55 | 7 |
WA#11 gepo 26 сен 2004 20:25 What means if gear-wheel have only one cog? Edited by author 26.09.2004 20:25 In this test have some gear not connect from other Try this test 2 1 0 1 0 1 6 answer 6/1 0/1 Edited by author 18.04.2005 12:50 |
| Hint | Solver | 2030. Защитная Бэкап-Система | 10 июн 2026 04:19 | 1 |
Hint Solver 10 июн 2026 04:19 There is simple O(N+M) algo (core part is like 5 lines), and it's "online" (no preprocessing of queries required) Edited by author 10.06.2026 04:20 |
| Small hint | andreyDagger`~ | 1155. Дуоны | 10 июн 2026 01:07 | 2 |
Notice, that you can move duons alongside diagonal (A->F, A->H, G->E, ...) Set up your own camera numbering. Change the C-D and H-G numbers. |
| Any Good algorithm?? My algo is O( H * W * ( 5 + 5 + 1 )^2 ). | c_pp | 1121. Филиалы | 9 июн 2026 10:46 | 2 |
Who know O(H*W) or, O(H*W*5) algo ??? You can dynamically update amount of branches per-type per-distance for each horizontal step leading to O(W*H*9) Edited by author 09.06.2026 11:10 |
| best tests | Dmi3Molodov | 1800. Закон бутерброда | 9 июн 2026 05:55 | 2 |
It is much more interesting to look for good tests for this task than just to solve it. Here is the AC program (with a small error in order not to publish solutions). I will look for where it will fail. #include<iostream> #include<cmath>//too lazy to write sqrt() yourself int main() { unsigned l, h, o; std::cin>>l>>h>>o; unsigned phase = 0; if(l<h*2) phase = o*sqrt((2*h-l)/981)/15+1; char const*answer[]{"Butter","Bread\n"}; std::cout<<answer[(phase>>1)&1]<<std::endl; } |
| You can use a segment tree for brace balance checking | Levon Oganesyan | 1574. Математики и скобки | 8 июн 2026 21:12 | 2 |
Tree for minimum is enough. It's O(N) problem with O(1) memory (apart from string itself) |
| Answer can be negative | Igor Parfenov | 1300. Налогообложение | 8 июн 2026 17:06 | 1 |
Input 0 50 10 0 0 100 200 -1 Output -5.00 I thought at first, that an absolute value has to be printed, which gets WA 3. |
| Could anyone provide me with an O(n) solution? My works O(n log(n)) | Sq1 | 1651. Кратчайшая подцепь | 8 июн 2026 15:30 | 2 |
Could anyone provide me with an O(n) solution? My works O(n log(n)) BFS for shortest path, but not over original graph - over the chain itself. There are edges of weight 1 and 0. |
| Accepted 0.156 2 993 КБ | TakeOver [MSU] | 1067. Структура папок | 7 июн 2026 23:42 | 4 |
Just used STL contaners such as std::map<std::string,T>, std::vector<T>. :) 33 lines of code. what is "T"? give please full description. I used a map and a set. My time was a little less than 2 times faster, and used a little more than 2 times more memory. struct dir { std::string name; std::map<std::string, dir*> children_items; std::set<std::string> children_names; }; The set gives you the sorted list. The map gives you instant access to a subdirectory of a given directory by name (taken from the set) Edited by author 29.12.2022 02:15 struct dir { map<string, dir> sub; } root; |
| WA test 8 | Henrique | 1588. Ямайка | 7 июн 2026 02:24 | 3 |
plz help me, i got WA on this test , if someone knows this one help me!. I think it's a test like: 3 0 0 0 3 0 2 and I just adjust my program I did it using integers keeping unique lines (a,b,c) a*x+b*y=c so that gcd(a,b)=1, a>=0. Mistake for WA8 was that for a=0 I did not ensure b>0, i.e. (0,1,1) and (0,-1,1) were considered as different lines. |
| Better algorithm | LLM_AI_Testing | 1553. Caves and Tunnels | 6 июн 2026 21:23 | 1 |
Use heavy-light decomposition: after O(N) preprocessing, every tree path becomes O(log N) contiguous ranges in the HLD order. Because cave radiation only increases, maintain range maximums with a monotone Fenwick tree, giving O(log N) per update and O(log^2 N) per path query with O(N) memory. Current #1 AC Edited by author 06.06.2026 21:24 Edited by author 06.06.2026 21:24 |