| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Strange thing... | Alexander Samal | 1191. Держи вора! | 8 фев 2011 16:17 | 2 |
If L == K, policeman doesn't catch the theif. I got AC when supposed so. Text from statement: "For instance, if L < K1, then it may happen that the policeman reaches the first stop when the robber is still waiting for a tram there." It means that you are right. |
| Data is too weak!! | CodeChomper | 1005. Куча камней | 8 фев 2011 07:07 | 2 |
Hello, administrator, I find this problem's data is too weak.Sometime before, I submitted my code to this problem, and got AC.Today, I sudden to realize my mistake, and I back to check my answer.Oh, my god, I had so stupid mistake.To my suprise, I had AC.So I think the problem's data is too weak.Please generate more strong input.. Hi! There seem to be many *accepted* solutions here that do not really try all possible combinations. These do *NOT* solve this problem, as some have pointed out correctly, this is a knapsack type of problem and unless going through all 2^n combinations of n numbers, you cannot find the optimal answer. It is clear, that the test data are too weak indeed!!! |
| 1001 Crash HELP | Visual_Studio2010 | 1001. Обратный корень | 8 фев 2011 01:55 | 2 |
I used the vector to solve this problem, but the system told me "Crash". I want to know why, so sent help to you, thank you. Below is my solution: #include <iostream> #include <vector> #include <math.h> using namespace std; int main() { vector<double> doubleVector; int i = 0; double cinVector = 0; // Read in numbers while (cin >> cinVector) { doubleVector.push_back(cinVector); i++; } // Display the results while (i > 0) { cout << sqrt(doubleVector.at(i)) << endl; i--; } return 0; } In addition, what will cause the "Crash"? Edited by author 07.02.2011 23:58 Input: n numbers After 1st while cycle: i = n doubleVector.at(i) - crash because size = n and only doubleVector[n-1] exists. And you should print numbers with 4 digits after the decimal point. |
| Explain tests plz. | Oleg Strekalovsky [Vologda SPU] | 1804. Пулемётчицы в плей-офф | 7 фев 2011 23:31 | 1 |
DELETED Edited by author 07.02.2011 23:41 |
| WA 5 | Muravjev Slava [Samara SAU] | 1067. Структура папок | 7 фев 2011 22:46 | 1 |
WA 5 Muravjev Slava [Samara SAU] 7 фев 2011 22:46 What is main mistake of programs, which has WA 5? If you can, write here the hardest or questionable tests, please. Edited by author 07.02.2011 22:48 |
| it seems that the solution needs high precision operation? | fjxmyzwd | 1818. Честные рыбаки | 7 фев 2011 20:24 | 1 |
try it out: N=1000 999 "0"and a single "1" |
| Some questions on the problem | mago_nn | 1768. Кольцевые струны | 7 фев 2011 19:32 | 3 |
If some points coincide, then the answer is yes or no? Edited by author 21.03.2011 02:21 |
| How to check for test cases which you failed? | Mark Wong Siang Kai | | 7 фев 2011 12:40 | 1 |
Hi, is there anyway to check which tests you failed? |
| I counldnt solve this problem easy and got AC only using AVL-tree... Can you explain me the easiest solution? | Petrenuk (NNSTU) | 1028. Звёзды | 6 фев 2011 16:41 | 2 |
int main() { int N = 0; scanf("%d",&N); rangs = new int[N]; Star *stars = new Star[N]; for(int i = 0; i < N; i++) { scanf("%d %d", &stars[i].x, &stars[i].y); } qsort(stars, N, sizeof(Star), StarCompare); AVLTreeNode *root = new AVLTreeNode(); for(int i = 0; i < N; i++) { rangs[i] = 0; } for(int i = 0; i < N; i++) { AVLTreeNode::Insert(root, stars[i].y, 0); } for(int i = 0; i < N; i++) { printf("%d\n", rangs[i]); } return 0; } Edited by author 05.02.2011 00:23 Two advices: 1) There's no need in Y-coordinates since points are sorted in input. Ignore them. 2) You should find a way to answer quickly on queries "how many numbers are lesser than given one". P.S. I used Binary Indexed Tree (Fenwick's Tree) for this problem and got a code of the same length as your pseudocode. ;-) |
| AC; after little bit tweaking the code I got TL#4 | ile | 1032. Найдите кратное | 6 фев 2011 00:20 | 5 |
This is ridiculous!! My AC solution (ACed twice) works in 0.950 seconds. Which is actually O(n^2). The code is long and nasty... After some "improvements" - ie changing ArrayList to LinkedList/getting rid off BitSet/etc - the running time should decrease drastically!! but it gives me TL... WTF? I was sure, that my "better" code works FASTER, since there is much less operations to perform... Can anyone help me with it? I can send the code to get feedback. Thanks! 0,015s dAFTc0d3r [Yaroslavl SU] 26 мар 2010 10:49 And I'm interesting how to solve this in 0,015s. well... There's good idea in neighbor thread, which proves that solution always exist. It can help you solve it in O(n). Or... you can think up your own ideas based on remainders... There's up to N remainders only... so I used BFS without considering duplicates... it works fast enough in Java. Re: 0,015s dAFTc0d3r [Yaroslavl SU] 27 мар 2010 01:42 Yeah, there is a nice idea. =) 0.14 seconds on JAVA, O(nlogn + n) solution |
| Please KISS...I Ac using brute force while WA using some logical derivation... | caoyuan9642 | 1804. Пулемётчицы в плей-офф | 5 фев 2011 18:45 | 1 |
I've got N*WA and AC today using simple searching algorithm.. |
| What kind of error will I receive if archive runs out of time? | IMX | 1307. Архиватор | 5 фев 2011 14:10 | 1 |
|
| To all who got wa17 | sklyack | 1685. Орфография | 5 фев 2011 00:49 | 1 |
With array of 20001 chars (with '\0') I got wa17, but of 20002 I got AC. So the input string can contain 20001 chars, can't it? And in the statement has been said "The text is no longer than 20000"... |
| Oh my lady gaga! | FranckRibery | 1269. Антимат | 4 фев 2011 11:54 | 2 |
There exists some symbol whose ascll is negative!!!! |
| Got wrong answer any pointers? | Stefan Jacobs | 1001. Обратный корень | 4 фев 2011 11:11 | 1 |
1 #include<stdio.h> 2 #include<math.h> 3 int main(void) 4 { 5 unsigned long long num; 6 int counter = 0,i; 7 unsigned long long list[16384]; 8 int ret; 9 while(!feof(stdin)) 10 { 11 ret = scanf("%Ld", &num); 12 if(ret == EOF) 13 break; 14 else 15 { 16 list[counter] = num; 17 counter++; 18 } 19 } 20 for(i=(counter-1);i>=0;i--) 21 printf(" %.4f\n", sqrt(list[i])); 22 return 0; 23 } 24 |
| WA #6 | rinat87 | 1027. Снова D++ | 4 фев 2011 02:52 | 3 |
WA #6 rinat87 6 окт 2009 00:59 give me test #6, please Edited by author 06.10.2009 00:59 Edited by author 06.10.2009 00:59 |
| WA3 | bagens | 1424. Маршрутка | 3 фев 2011 22:55 | 1 |
WA3 bagens 3 фев 2011 22:55 Getting wrong answer. Can anybody post tests, please? |
| How should I output? | Dmitry 'Diman_YES' Kovalioff | 1219. Symbolic Sequence | 3 фев 2011 22:43 | 10 |
As you can see the task is to output the sequence consists of 1000000 symbols. I output exactly 1000000 symbols one by one (...Write (sym)...Write(sym)...Write(sym)...), buf after 0.04 seconds I receive "Output Limit". What does it mean and how should I output the sequence? Please, help me! That simply means that you do NOT output 1 million chars! I have the same problem, and I can't solve it. But if I decrease the number of outputs then I get WA. I used putchar(buffer[j]); instead of printf("%s",buffer) and I got accepted. I really don't know why. > As you can see the task is to output the sequence consists of 1000000 > symbols. I output exactly 1000000 symbols one by one (...Write > (sym)...Write(sym)...Write(sym)...), buf after 0.04 seconds I > receive "Output Limit". What does it mean and how should I output the > sequence? > Please, help me! var i:longint; begin randomize; for i:=1 to 1000000 do write(chr(ord('a')+random(26))); end. You are GENIUS!!! The god of programming :)) I think your solution is really perfect! > You are GENIUS!!! The god of programming :)) I think your solution is > really perfect! I made: var i:longint; begin randomize; for i:=1 to 1000000 do write(chr(97+random(26))); end. use 97 instead of ord('a')!!! I still believe u r geinus Aidin To make this program shorter one can substistute "1000000" on 1e6. P.S. To Smilodon_am: You can't use 1e6 with the FOR cycle because it needs only INTEGER expressions. Edited by author 03.01.2009 01:40 Edited by author 03.01.2009 01:41 I also solved like this but the way I got to this solution was kind of intuitive, so I am not still sure why this solution gets AC, I can't prove it. Do you have any proof why it does so? |
| problem description has a mistake? | Takamoto | 1005. Куча камней | 3 фев 2011 22:27 | 2 |
Hi, Maybe I misunderstood the problem. With the given numbers, you could actually make two piles 27,8 in one and 13,14,5,5 in the other, and the difference would be just 2. Where did I misunderstand? sorry, my mistake! the first number is actually the number of stones! |
| Whwre am I wrong? | Freezing Sun | 1005. Куча камней | 3 фев 2011 22:24 | 6 |
My code sorts all the weights in descending order and then arranges them into two piles using algorythm: 1. Start with the heaviest stone; 2. If weight(pile1)<Weight(pile2) add current stone to pile1; Else add current stone to pile2; 3. If there are more stones current stone = next stone; Goto 1; Consider the following example: 5 10 10 8 7 5 Your algo will give answer 4, while the correct one is 0. Use brute-force to solve the problem. why? I think the algorithm described by Freezing Sun would (and should) return the correct answer here: 1 I think that the correct algorithm is using DP, like this: If you figure out a way to find the sum of each possible subsets from {w0...wn}, and you know that w0+w1+..+wn = N... for some N, then the problem is reduced to find the set that gets closer to N/2. IOW: Suppose you have a set and the sum of its elements is equal to N/2.. Then the sum of the other set is also N/2, so the difference is 0... And the difference will always be minimal near N/2.. so if you can't get N/2, try finding the one closer to it. the way I did it is: ... S := {w0,w1,...,wn} B := array(Bool, #(S), false) B[0] := true // you can always pic the empty set for i in S: for j in range(0, N): if B[j] = true: B[j+S[i]] := true ... This gives you all possible sums of the possible subsets of S like this: B[i] = true if there exist a set S' of S such that (sum(S') = i) holds. Hope I wasn't very bad at my english.. :S See ya gaston770@gmail.com gaston770 right , DP. This problem is same tpye as knap of problem. W=Sum of w[i],i=1..n, N=W/2; find N=w[j1]+w[j2]+...+w[jk]:j1,j2,..jk in set[1..n]. Good luck. Edited by author 07.04.2010 08:51 The size of input is too small, so you can try all the dispositions of N/2 stones. c(10,20) is less than 200000 ;) |