| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Question about problem | __Andrewy__ | 1824. Ифрит-бомбардировки | 28 июл 2017 05:11 | 2 |
I solved this problem( 0.015 sec) but My algo is heuristic. Why this problem is geometric? Or how can we use geometry in this task to reduce the search? I think there might be as well a mistake in tags. To me, this problem reminds of http://acm.timus.ru/problem.aspx?space=1&num=1326 with minor differences: 1) cities = bottle taps 2) N <= 30 instead of N <= 20; 3) city's "group" is a list of cities hit when bombing this one. |
| If you have Runtime error #9 (stack overflow) in Visual C++ | Izaron | 2109. Туризм на Марсе | 28 июл 2017 00:59 | 2 |
Insert this magic line before the code #pragma comment(linker, "/STACK:36777216") And it works! That is not magic That line sets stack size to 16 MB And you forgot the most important thing The code works ONLY with Microsoft Visual C++ |
| Какие условия для ввода-вывода? Или почему выдает ошибку Wrong Result н такой простой задаче? | Alexander | 1000. A+B Problem | 27 июл 2017 23:03 | 4 |
#include <iostream> #include <iomanip> using namespace std; int main() { setlocale(LC_ALL,"Russian"); int a,b; cin>>a>>b; a=a+b; cout<<"a+b="<<a<<endl; return 0; } Посмотри на прример. Что надо вывести? А теперь посмотри, что выводит твоя программа. Не находишь ничего лишнего? Как прикажешь компьютеру проверять твой ответ? да уж, думал тут действительно нормальные задачи, а задание через зад написано =( Обратите, пожалуйста, внимание К каждой задаче даётся хотя бы один пример ввода/вывода |
| I'm not sure that input string's len less or equal 10k (WA25) | achpile | 1354. Палиндром. Он же палиндром | 27 июл 2017 16:20 | 1 |
I had WA25 when used char[20002]; After changed to char[30002] got AC. |
| Help! Please. I got WA on test #5. Can Anybody give me some tests data? Help me, PLEASE | Victor Barinov (TNU) | 1311. Устойчивая конструкция | 27 июл 2017 16:14 | 6 |
0 /Yes 1 1 0 10000 /Yes 1 5 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 /Yes 2 1 0 2 1 1 3 /No 2 1 1 3 1 0 2 /No 2 1 1 1000 1 1001 2000 /No 2 3 1 10 11 20 21 30 1 5 26 /Yes 2 3 1 10 11 20 21 30 1 5 25 /No 2 1 21 30 1 5 25 /No 4 2 4 5 6 7 1 4 7 1 3 6 1 2 5 /No Thank You very much. Now I got AC. I found mistake in my programm. It's a lot help checking the board here before submitting. I got AC with one shot. 2 1 0 2 1 1 3 /No 2 1 1 3 1 0 2 /No can you explain why? OK, i got it. [0,2] contains only {0, 1} cells, but i thought {0, 1, 2} |
| I got wa on #7 | a_little_black | 1297. Палиндромы | 27 июл 2017 13:16 | 4 |
I was so upset that I wa on #7 more than 10. I want to practice my suffix array,so I used it and used RMQ,But I wa on #7. I very want to know what is #7. Can the admin give the simple to me? thanks a lot http://paste.ubuntu.com/23169621/the suffix array algorithm is right cause I got AC ever using this Template~~ I got ac now cause I use a character '$' to end my suffix array . I think is ok but got wa on 7..why? Latin alphabet letters is not abcdefg.....ABCDGEF...? no no no . cause my book[] is smaller. book[500 + 20] is not enough? I see . the length of string is 2000 Edited by author 12.09.2016 21:19 |
| Легендарный Николай Дуров | Nikita Mogilevets | 1161. Stripies | 26 июл 2017 23:54 | 1 |
Приятно было прикоснуться к наследию легендарного человека Я знаю, что здесь еще есть от него задача Currency Exchange |
| TLE with G++ 4.9, AC with Visual C++ 2013 | zlo | 1737. Мнемоника и палиндромы 3 | 26 июл 2017 17:17 | 2 |
For some reason I get TLE with G++ 4.9 and AC with Visual C++ 2013 with exactly the same code. I tried to use scanf/printf instead of cin/cout, but had no difference. On my machine this code works <100ms for every n with G++. Can anyone explain why I get TLE with G++? Thanks! #include <string> #include <queue> #include <iostream> using namespace std; int main() { int n; cin >> n; queue<string> result; result.push("a"); result.push("b"); result.push("c"); char abc[] = {'a', 'b', 'c'}; for (int i = 1; i < n; i++) { while (true) { string &s = result.front(); if (s.size() > i) { break; } char last = s[s.size() - 1]; if (s.size() > 1) { char lbo = s[s.size() - 2]; for (int k = 0; k < 3; k++) { char c = abc[k]; if (last != c && lbo != c) { result.push(s + c); } } } else { for (int k = 0; k < 3; k++) { char c = abc[k]; if (last != c) { result.push(s + c); } } } result.pop(); } if ((i + 1) * result.size() > 100000) { cout << "TOO LONG"; return 0; } } while (!result.empty()) { cout << result.front() << endl; result.pop(); } return 0; } Because s+c is a temporary object You are creating temporary objects and throwing them away O(N) times Looks like G++ failed to notice that it is unnecessary to create and destroy objects And MSVC noticed that and replaced with something more effective |
| actually this is an easy problem! | Krum Bakalsky | 1220. Stacks | 26 июл 2017 16:16 | 5 |
no bitwise shit needed, no storing 17 bits for indexes and no such stuff! just use unsigned stack* [1000] for the stacks (store elements in a dynamic array, reallocating memory for each push), and unsigned top[1000] for the index of the top element. with this i got AC with 663 KB! good luck! Looks like solve the problem in such a manner is no longer possible Because ,as of 2017, there is no Intel C++ compiler And every other compiler fails to allocate memory effective Probably when reallocating there are empty spaces which count as memory used And Intel Compiler was able to get rid of such spaces. После того как наконец сдал, хочется сказать, что на самом деле OP очень переусложнил задачу, динамическая память не нужна. Достаточно статического выделения. Которое к слову очень быстро работает -- за 31 мс. Я много раз ловил WA#8. Здесь предлагали тест на WA#8. Тест у меня работал хорошо. Ошибка, как выяснилось, была в том, что я перепутал переменную с названием block_size с переменной block_cnt. Edited by author 26.07.2017 16:19 Одно из решений использовало сдвиг O(N) ячеек массива каждую операцию Ценой диких оптимизаций удалось довести его до TLE#16 (только на Clang, любой другой компилятор C++ позволял получить только TLE#12) Edited by author 26.07.2017 16:21 |
| Very severe test: #25 | SkidanovAlex | 1739. Фарюки | 26 июл 2017 14:43 | 3 |
As stated in the statement, after spraying or aromatizing of fruit it may become to have fractional value. 25th test is the first case where you need to aromatize one flower and dearomatize another in such way that both of them have fractional value, but their sum is integer. Edited by author 07.11.2009 05:19 I've changed my algorithm, but have got WA25->WA19. Who knows what does it mean? Nevermind, I had a stupid bug with bitmasks (I'm wondering how it could pass 19-25 tests). Thank you very much, this was a non-obvious test. |
| WA 5 | bsu.mmf.team | 2093. Все дороги ведут в сугроб | 26 июл 2017 14:08 | 2 |
WA 5 bsu.mmf.team 16 июл 2016 02:13 Try this test: 100000 99999 0 1 2 1000000 2 3 1000000 ... 99999 100000 1000000 Answer: 10049708502000000 Good Luck! Thanks! HINT for solvers: In the test above, you can get an overflow. Change min(⌈(1 + T/100)* ti⌉, 100500*ti) to long long my_ceil(long long tnow, long long f1, long long t) { if(h1+tnow-f1>h2*h1) return h2*t; //return min(ceil(t+(tnow-f1)*t/100.0), h2*t); if(((tnow-f1)*t) % h1==0) return t+((tnow-f1)*t)/h1; else return t+((tnow-f1)*t)/h1 + h3; } //h1=100; h2=100500; h3=1; where tnow=time now, f1=last cleaning time for this rib, s2=start time of next cleaning Edited by author 26.07.2017 14:10 |
| Is O(n^3) solution - DP one? | YuYu8 | 1146. Maximum Sum | 25 июл 2017 23:18 | 3 |
Solution looks like bruteforce with a precalc, not a dynamic programming one. Or precalc counts as DP? Or DP is just a clever bruteforce? Edited by author 25.07.2017 20:10 Are you calculating something like "maximal sum subarray" ? That is where it is DP. If you are doing Kadane algorithm You are doing essentially that thing dp[i] = max(0, dp[i-1] + matrix [i]) answer = max(dp[i]) |
| Weak Dataset | Saifullah Talukder | 1280. Topological Sorting | 25 июл 2017 14:16 | 1 |
I think the dataset for this problem is weak. I got AC without checking for cycles. Input: 3 3 1 3 3 2 2 1 1 3 2 Correct output: NO But my code ( http://ideone.com/ZljGZ5 ) returns YES and it got Accepted. Edited by author 25.07.2017 14:17 Edited by author 25.07.2017 14:18 |
| Почему - то после того после АС на этой задаче хочется радостно кричать. | Nikita Mogilevets | 1326. Крышки | 24 июл 2017 19:41 | 3 |
И не только мне, как показывает форум. Можно решить это с помощью алгоритма Дейкстры. Моё время на Clang C++14 равно 2.7 сек. На Visual C++2013 вообще TLE#8. Стало понятно от чего кайф Из-за того что я еле-еле успел в time limit Ожидания были, что случится memory limit с большой вероятностью, поэтому я взял сразу Visual C++ |
| WA#2 | ZuTa | 1379. Транспортировка кружек | 24 июл 2017 14:21 | 5 |
WA#2 ZuTa 7 май 2006 02:33 Give me some tests. PLEASE. Re: WA#2 Georgiy Savchenko 29 окт 2006 12:06 Re: WA#2 exwRabbits_AlMag(VNTU) 29 окт 2006 16:49 And what is the correct answer for this test? |
| Python 3.4: Why my solution is wrong? | Nabi | 2012. Про Гришу Н. | 24 июл 2017 13:19 | 6 |
a=int(input()) tasks_left=12-a if tasks_left*45<=240: print('TRUE') else: print('FALSE') Because you should output "YES" /"NO" , not "TRUE" /"FALSE" Edited by author 21.07.2017 10:33 but it doesnt work. a=int(input('input solved task:')) tasks_left=12-a if tasks_left*45<=240: print('YES') else: print('NO') Thanks. Now it's work. i've changed from a=int(input('input solved task:')) to a=int(input()) |
| Some tests | __Andrewy__ | 1673. Допуск к экзамену | 24 июл 2017 10:49 | 1 |
144 ->185 29756 ->29929 800000000 ->1001578525 41088 ->51365 123456 ->123457 1369 ->0 369 ->0 1024 ->1285 58 ->59 21414 ->0 2000000000 ->2500015625 961 ->0 1870 ->1871 23432 ->35151 P.S. use long long (else WA7) |
| Python3 help me to understand, what is wrong? | master8282 | 1002. Телефонные номера | 24 июл 2017 06:33 | 1 |
http://ideone.com/KOHykO Examples and my examples work. ideome works How to look at all stdin ??? Edited by author 28.07.2017 03:35 |
| wrong AC | AGrigorii [Yaroslavl SU]🔥 | 1861. Кладбище в Дейе | 24 июл 2017 04:23 | 1 |
wrong AC AGrigorii [Yaroslavl SU]🔥 24 июл 2017 04:23 ?????abxxxab????? abab output: 3 answer: 4 |
| TLE on test18 | Volkov Stanislav [MSU_Tashkent] | 1491. Нереальная история | 24 июл 2017 01:14 | 2 |
I use very simple algo, prompt other algo please. Edited by author 10.08.2011 15:32 Segment tree with range update, obviously. And even Fenwick tree with range increment. (Petr described such a Fenwick tree in his blog) |