| Show all threads Hide all threads Show all messages Hide all messages |
| Simple problem | Vladislav | 1320. Graph Decomposition | 29 Mar 2014 23:00 | 1 |
It's very simple problem because all connected graphs which containes even number of edges can be divided into pairs of edges, which includes one common vertex!!!(and all connected graphs with odd number of edges can't be divided in such way) |
| Fractional part detection | bsu.mmf.team | 1942. Attack at the Orbit | 28 Mar 2014 21:54 | 4 |
I used this code: double x, y; cin >> x >> y; x *= 1000; y *= 1000; int X = (int)x, Y = (int)y; But this code doesn't work properly. For example, if x = -1.001, then X will be -1000 (in some cases one unit is lost). How to avoid this in C++? To solve this problem I had to read whole string and then parse it :) My method got AC: cin >> a; A = (int)(a*1000.000001); I use (g++11) double a; scanf("%lf",&a); p[j] = (int(a*1000.000001) + 100000) % 1000; "a*1000" gives WA "cin >> a" gives TL45 even with "cin.sync_with_stdio(false)" This task use some architectural float issues. So we need minimize to use real numbers. I try many times, but get AC only with manual parsing: x,y = sys.stdin.readline().strip().split() xs,ys = x.split('.'), y.split('.') x = int(xs[1]), y = int(ys[1]) if xs[0][0]=='-': x=-x if ys[0][0]=='-': y=-y I use float number only one time - in last line, in sqrt. |
| I want to find my code problem . help me!!!. | master amir | 1001. Reverse Root | 28 Mar 2014 19:47 | 2 |
#include<iostream> #include<stdio.h> int main(void){ double a; int i = -1; double NUM [100000]; while(EOF != scanf("%lf", &a)){ NUM[++i] = sqrt(a); } i--; while(i>=0){ printf("%.4f\n",NUM[i]); i--; } return 0; } Have you less a header file <math.h>? |
| Different Solution | Jobed | 1209. 1, 10, 100, 1000... | 28 Mar 2014 15:47 | 1 |
long n=2*(value-1); long sqr=(long) Math.floor(Math.sqrt(n)); if((sqr*(sqr+1))==n) print(1); else print(0); Edited by author 28.03.2014 15:49 |
| No subject | david | 1654. Cipher Message | 28 Mar 2014 11:14 | 1 |
Edited by author 28.03.2014 12:04 |
| Is this a valid test case? | Ade [FDU] | 1369. Cockroach Race | 28 Mar 2014 03:36 | 2 |
Is this a valid test case? 2 -9999 -1 -9999 1.00000000000000000001 1 9999 0 I know the answer should be 1. But it's hard to code. Edited by author 08.03.2014 14:22 My AC program answers 1 2 I don't think doubles allow such precision. |
| no subject | Даниил | 1837. Isenbaev's Number | 28 Mar 2014 02:12 | 1 |
Edited by author 28.03.2014 23:31 |
| good idea !!! | AlisheR Tojiev [☆UZB★TUIT☆] | 1706. Cipher Message 2 | 28 Mar 2014 01:18 | 3 |
aabaaab => { 0 1 0 1 2 3 } a 0 aa 1 aab 0 aaba 1 aabaa 2 aabaab 3 abcabcd a 0 ab 0 abc 0 abca 1 abcab 2 abcabc 3 abcabcd 0 0 0 0 1 2 3 0 |
| BFS or DFS | coolfishchen | 1002. Phone Numbers | 27 Mar 2014 23:49 | 10 |
When I used BFS,I found it would exceed the time limit. Does DFS also will exceed the time limit? BFS got AC. I had AC, when use BFS, I dont know, why you got TL... Maybe your progrm is incrorrect, because BFS really got AC! If BFS got AC, tests for this problem is extremely weak... you are wrong: we can construct graph with n = 100 verticles and BFS solve it in O(n^2) no, DFS is bad for this problem: we must compute the shortest sequence of words so DFS can work as slow as backtracking, exponential time Maybe you're right but I ment DFS with some changes) I also do DFS and got Time Limit on test 6 |
| hint | ASK | 1776. Anniversary Firework | 27 Mar 2014 23:03 | 1 |
hint ASK 27 Mar 2014 23:03 Use probability P(i,j) that a line with i rockets is finished after at most j salvos. The probability that it ends after exactly k+1 salvos is P(i,k+1)-P(i,k) = 1/i sum_l P(l,k) * P(r,k) - P(l,k-1) * P(r,k-1), where l is the index of the first launched rocket and thus the size of the left part and r is the size of the right part (r=i-1-l) of the line. The output is with cout << setprecision(12) << s*10 << endl; Edited by author 27.03.2014 23:04 |
| For Admin.... Please check Test 10. | Adham (TWYT Union) | 1440. Training Schedule | 27 Mar 2014 16:05 | 1 |
I think my program is correct but i have not accepted yet. why wrong answer #10.. please give me Test 10. |
| wa21 | Misha | 1785. Lost in Localization | 27 Mar 2014 12:42 | 4 |
wa21 Misha 20 Aug 2013 11:59 if a in [1..4] then write('few'); if a in [5..9] then write('several'); if a in [10..19] then write('pack'); if a in [20..49] then write('lots'); if a in [50..99] then write('horde'); if a in [100..249] then write('throng'); if a in [250..499] then write('swarm'); if a in [500..999] then write('zounds'); if a > 999 then write('legion'); Got same problem and my program is identical, have you found what the issue is ? Re: wa21 Mescheryakov_Kirill 27 Mar 2014 12:42 Try through a "case" case of a 1..4:write('few'); 5..9:write('several'); ... 1000 2000..:write('legion'); end; end. |
| Can the words be repeated in the output?? | Rosandra | 1002. Phone Numbers | 27 Mar 2014 01:18 | 4 |
Maybe that is what i am doing wrong. If i have a set of words, say: it your reality real our Can the output be something like: reality our reality or the words can't be repeated?? I think it is depend on telephone number and on condition of problem :) Ya, they can. I've also misunderstood the task firstly. Otherwise, it is damn hard. |
| WA3 | I.Smirn0ff | 1590. Bacon’s Cipher | 26 Mar 2014 22:13 | 2 |
WA3 I.Smirn0ff 26 Mar 2014 20:48 Please give me some tests. Re: WA3 I.Smirn0ff 26 Mar 2014 22:13 I found a bug in the code, i wrote wrong z-function. Test aaabaaaab correct answer is 29 |
| к жюри | xMagGTU Дмитрий Тишкин GPRS | 1533. Fat Hobbits | 26 Mar 2014 01:54 | 9 |
к жюри xMagGTU Дмитрий Тишкин GPRS 3 Mar 2007 14:00 перепроверте тесты задачи B pls чё за xMagGTU Дмитрий Тишкин GPRS 5 Mar 2007 00:00 исходя из условий задачи необходимо вывести номера хобитов(строк) состоящих из одних нулей предворив список на отдельной строке числом таких строк засада при случае когда таких строк нет( возможен когда матрица содержит ошибочные данные тк как всегда должен имется легчайший хобит) ВОПРОС почему так мало ac? у такой на первый взгляд простой задачи? намекните pls! not so easy, try this test: 3 0 0 0 1 0 0 1 0 0 answer: 2 2 3 or this: 3 0 0 0 0 0 0 1 1 0 answer: 2 1 2 По-моему так это NP-полная задача на 100 узлов Edited by author 16.09.2010 19:25 Эта задача решается за O(n^2) + Кун. Так что совсем быстро :) |
| Wrong test? | Nodir NAZAROV Komilijonovich [TUIT-Karshi] | 1440. Training Schedule | 25 Mar 2014 23:08 | 1 |
Wrong test? Nodir NAZAROV Komilijonovich [TUIT-Karshi] 25 Mar 2014 23:08 I think there can be several correct answers, and not all of them are accepted. Is order of days important (Monday, Wednesday, Saturday == Saturday, Monday, Wednesday)? For 3rd test my program prints "Monday, Tuesday, Wednesday" which gives 14 days. Why I got WA#3? Thanks |
| test 2?? | LyanA | 1931. Excellent Team | 25 Mar 2014 20:09 | 3 |
even no idea tried this 10 3 5 6 7 2 8 9 7 5 6 5 get 5 My error was that I didn't check after the end of the loop if my current numbers of swaps is bigger than the now kept max . Try this test : 8 2 3 4 1 5 6 7 8 Answer : 4 check this test: 7 2 3 4 1 5 6 7 Answer : 4 |
| For those who can't pass test 1 in C++ | Robert Ayrapetyan | 1001. Reverse Root | 25 Mar 2014 09:37 | 3 |
I'm not quite sure where the problem is, but here is the story. First, I tried to submit solution which worked well on my machine (64bit OS), but test 1 was constantly failed on timus server. I've tried to change (almost) everything in my code without success. Then I started to google solutions. Surprisingly, they didn't worked either (e.g. http://helloacm.com/coding-exercise-timus-1001-reverse-root-c-solution-online-judge/ is provided as a working solution, but it also fails on test 1). I've started to think that something is broken on the timus server or I'm choosing wrong compiler version or hell knows what else. Then I've found another solution which was... accepted! Started to comparing it with mine line by line and found following: whatever I use in scanf (llu, lld) - it works fine on my machine, but on remote server it fails. When you replace scanf by cin - it works both locally and remotely. So in short - do not use scanf for this task, use cin. It will be very interesting to know why this happens, maybe someone could explain? What do you mean by "not working"? WA or sth else? As for me, it doesn't work either way. Either scanf, or cin it's wa1, I don't know why. Pechal' Right, somehow sscanf("%lld") doesn't work. Use strtoll() instead. |
| If you have problems with #31 | Vladislav | 1410. Crack | 25 Mar 2014 01:59 | 1 |
If you have problems with test #31, you must know that in test #31 there are now words)) only delimiter characters! |
| Memory limit exceeded | Nataraj | 1992. CVS | 24 Mar 2014 14:52 | 3 |
I am writing my solution in Java and I constantly getting "Memory Limit Exceeded" error on 10th test. I used ArrayList<Integer> to store 'programs' and 'rollbacks'. Then lately I changed it TIntArrayList, to store 'int' as a basic type, but still it does not solve the problem. I saw solutions in Java, that people used less than 10Mb of memory. What am I doing wrong? Edited by author 23.03.2014 18:03 Edited by author 23.03.2014 18:04 Fully rewrote the algorithm, to calculate the solution each time in runtime, without using memory for each clone, but then my solutions exceeds Time limitation on 9th test. I also do not understand why we get a number 'm' - number of educational program. How this number could help us to solve the problem? Finally solved it. The main trick was to find a way to make clone operation without coping all the clone memory. |