|
|
O(N*logN) or O(N+max(P))? Problem description is very unclear on what to do when N=0. I believe that either * test case N=0 must be clarified or * lower bound of N must be set to 1. Hint: In current test suite the correct answer for N=0 is empty output. can you find other sequence like this , input = output No, it isn't. 1 2 3 -> 3 2 1 -> 3 2 1 'input = output' when the input sequence is already sorted by non-increasing. Before realize that, I had to solve it in the way it's described on the statment, but later of try several test cases, I figured out the real problem. Just sort it in descending way. Good luck. I can't believe this. Edited by author 25.08.2015 10:37 I have Python 3.4.3 on my PC and when I run the program, this happens: input: 3 4 5 3 output: 5 4 3 I am certain that is the correct answer, but the judge says that it is incorrect hi I need some test to check my code it works ok when I enter numbers but not accepted in "test 2" Извените, чо пишу на русском - по другому не умею. По поводу теста №2, в котором на вход подается 0, а правильным решением является пустая строка. Лично мое мнение: результатом должен быть массив длиной 1 с первым элементом равным 1. Объясню: В условии задачи сказано, что входными данными являются число N(длина массива) и элементы этого массива. Предполагается, что N может быть равно 0. Массив поступает в функцию, которая возвращает массив, первым элементом которого является длина входного массива. Из этого можно зделать вывод, что, если на вход задачи может поступить массив, у которого указана длина 0, то и функция при обрабоке этого массива должна вернуть массив длиной 1 с первым элементом равным длинне массива, тоесть 0. После обработки этого массива функцией и получится массив длиной 1 с первым элементом равным 1. Лично я не догадался, что результатом будет пусая строка (пришлось подсмотреть на форуме). What's (input) in a test №8? Здравствуйте, прошу прощения за русский язык (проблемы с английским)... Число 1 не строго больше одного, а значит, ошибка в условии задачи, т.к. при Вашем условии при вводе 4 1 6 на принтер выведется 2 2 1 1 и вывод программы будет 2... Исправьте, пожалуйста, условие для того чтобы не возникали недоразумения. СПАСИБО! "Функция организует следующую процедуру: на принтер выводит количество чисел в массиве, далее количество чисел, строго больших одного, ..." Именно это я и имел в виду! "далее количество чисел, строго больших одного..." А у в примере единица также учитывается... Первое число - количество ВСЕХ чисел в массиве! How can we make this results -- 0.001 sec -- 1 128 KB ? This is the best result for this problem. I wonder how can we get this results. You can see this result by clicking the link Solution Rating on problem statement. :: http://acm.timus.ru/rating.aspx?space=1&num=1290 :: Edited by author 08.10.2012 12:45 Edited by author 08.10.2012 12:46It is not possible to achieve 0.001 sec result with the current judge. The measurement for an empty program that only calls puts("\n"); is 0.015 at this time. Until the measurement mechanism is changed, those who submitted results years ago will be the only ones to achieve 0.001. Can you help me, plz? Edited by author 26.07.2006 15:15 Edited by author 27.07.2006 19:37 My program also WA#2. I have implemented 'inserted sort'. Sorts correctly. Don't know what's the problem... PS. What should output program if n == 0? I print '1'. Any right implemented sort (which passes time limit) gets AC. So I think you are mistaken. PS: for n=0 answer is empty output. Thank's. Problem was n=0. Why for n=0 output is empty(i agree that it get AC, but...)? Is it wrong? : 0 --> (one number in input)1-->1 what is the problem with output if n==0 ? If n=0 nothing should be output ! If n=0 nothing should be output ! <html> <title>Codeforces.com</title> <body bgcolor="#F0FF0F"> Test Yourself ! <a color="#FF0000" href=" http://codeforces.com">Codeforces.com</a> </body> </html> If n=0 nothing should be output ! To be careful : use vector<short> or arrays const long n_max = 25001;// if n_max = 25000 => WA14!!!!!!!!!!!! long n1, n2, n3, p1[n_max], p2[n_max], p3[n_max]; if (this==0) return 0; // You are Ъ. поправил, забыл убрать =) да я знаю, просто на саботаже хорошо тестить правильность построения деревьев. про эти деревья как я понял - одно дерамиды, второе не знаю, но есть еще авл-деревья. впрочем красно-черные самые труЪ с++ весь на них Не C++, а STL. Grammar Nazi следит за тобой... #include "algorithm" ...//input sort(a,a+n); ...//output it is my program)) Edited by author 14.04.2009 15:03 Why not use SizeBalancedTree? It is much faster and more convenient. #include <fstream> #include <string> #include <cstring> #include <vector> #include <cmath> #include <queue> #include <map> #include <set> #include <stack> #include <sstream> #include <time.h> #include <queue> Edited by author 30.04.2009 12:44 Try to sort sequence from max to min and output, nothig more... Edited by author 07.03.2008 00:36 Hi. Do you know anything special about Test #8? You can use simply sorting (for example QuickSort) It's shooting from a cannon on sparrows Edited by author 18.10.2005 03:10 In the worst case you will have to perform the O(N^2) number of operations as with insert sort. Therefore there is no need for that |
|
|