| Show all threads Hide all threads Show all messages Hide all messages |
| Please explain me | Ulyanovsk STU: Kadeev Artem | 1007. Code Words | 23 Aug 2008 22:42 | 1 |
Edited by author 23.08.2008 22:49 |
| any hint ? | Locomotive | 1244. Gentlemen | 23 Aug 2008 22:02 | 5 |
Hint (+) Oberon (Yura Znovyak) 5 Mar 2003 02:02 For each mass store amount of possibilities you can get it. If this number exceeds to than you can lower it downto 2. NumGet: array[0..MaxCardMass * MaxCards] of byte; For each mass store atleast one (if possible) card wich can create that mass. WhatGet: array[1..MaxCardMass * MaxCards] of byte; You need 1000*100 * 2 arrays of bytes. Start DP with 0 cards; NumGet[0] := 1; for CurrentCard <- 1 to CardCount do for i <-SumOfAllCards - CardWeight[CurrentCard] DOWNTO (!!!) 0 do if NumGet[i] <> 0 then Inc(NumGet[i + CardWeight[CurrentCard]], NumGet[i]); if NumGet[i + CardWeight[CurrentCard]] > 2 the NumGet[i + CardWeight[CurrentCard]] := 2 if WhatGet[i + CardWeight[CurrentCard]] = 0 then WhatGet[i + CardWeight[CurrentCard]] := CurrentCard; Downto needed to avoid next trap: consider we can get mass 100 know we check card with mass 10 when i = 100 we mark that we can get 110 when i = 110 and it is (already marked) we mark 120 when i = 120 ... ... Hope this will be helpfull...
I have the same idea as you.but i got WA.Please help me. I think we should check if there is no solution(output 0) first,and then check if there is more than one solution(output -1). am I right? Here is my program: [code deleted] Edited by moderator 27.03.2007 09:45 Knapsack at all, guys, as well :) It's so helpfull... Thank you. :) |
| WA6 | Marpu Vamsee | 1617. Flat Spots | 23 Aug 2008 19:53 | 1 |
WA6 Marpu Vamsee 23 Aug 2008 19:53 Getting wrong answer on test case 6. But i think my program is correct can anybody tell me what is the test case for 6? |
| the answer to the test like (*(*) is YES | wrbuaa2005 | 1027. D++ Again | 23 Aug 2008 19:05 | 1 |
|
| WA5 | Vladimir Kulikov | 1422. Fireflies | 23 Aug 2008 17:08 | 3 |
WA5 Vladimir Kulikov 17 Dec 2006 12:45 Re: WA5 elmariachi1414 (TNU) 5 Jul 2007 03:45 I have no tests, but it could be overflow or wrong compare function Re: WA5 Denis Koshman 23 Aug 2008 17:08 I had WA5 when I performed sort for X/Y and X/Z only. Adding sorting for Y/Z as well led to TL9 at least. I think that flipping X/Y around origin to make Y>=0 and flipping X/Z around origin to make Z>=0 later cannot be done independently, or there is some other problem of this type. |
| Test #5 | Carbon | 1056. Centers of the Net | 23 Aug 2008 11:33 | 3 |
Please, tell me what does that test look like? I'm failing the same test. Can anybody provide it or some details about it? Edited by author 24.08.2008 03:57 |
| TEST | RockBeat | 1422. Fireflies | 23 Aug 2008 07:04 | 3 |
TEST RockBeat 7 Jan 2007 00:50 My prog got ac, but haven't passed this test: 4 1 1 1 1 1 1 1 1 1 1 1 2 correct answer - 4, answer of my prog - 2. It is obvious two objects can not be located at one point (otherwise we'd mention it in the statement). But if you have some new correct tests, you may send them to dimanyes@gmail.com, and we will add them into the test set. (usually authors care to mention only the opposite :) |
| (+)Special Hints, esp WA on 55!!! | Safe Bird | 1361. Spaceology vs. Chronistics | 23 Aug 2008 02:15 | 3 |
The compiler has been changed to VC. long long is still available but we must use %I64d instead of %lld!!! Which VC? 'cuz my VC2005 eats both %lld and %I64d, both __int64 and long long. Read faq Vladimir Yakovlev (USU) 23 Aug 2008 02:15 |
| H E L P M E O P T I M A L A L G O R I T H M | Meni Packeou | 1028. Stars | 22 Aug 2008 21:49 | 1 |
My solution TLE. I not know program what optimal algorithm. Help me |
| What is the most simple way... | DK [Samara SAU 1: X2008] | 1616. Square Country 4 | 22 Aug 2008 17:41 | 2 |
What is the most simple way to find an area of two squares' intersection? Find it as intersection of two arbitrary convex polygons, otherwise you'll bury yourself in special cases. To do so get all points of one polygon inside the other, all points of the other polygon inside the first one, and also all their intersections by non-parallel sides. Then find area of their convex hull. Angle/distance sorting step is enough to find that hull. |
| Неправильные данные | Maherka Vasyl (Ternopil NPU) | 1616. Square Country 4 | 22 Aug 2008 17:37 | 2 |
Сразу прошу извинения за то, что пишу на русском... У меня вопрос: как может заполнена клетка, где большая буква? ........ ........ ...aa... ..aA.x.. ..a..x.. ...bb... ........ ........ ведь все те клетки, что с ней пересекаются, симметрические относительно нее. Заранее спасибо за помощь! What do you mean by "symmetric"? It's 45-degrees turn. |
| Why "Impossible" in the second case? | Burunduk1 | 1485. Football and Lie | 22 Aug 2008 14:18 | 2 |
Why this answer is not correct? 0 3 1 0 0 0 0 3 1 1 1 0 0 1 1 3 1 1 0 0 3 1 1 0 0 Teams 4 and 5 played 0-0. Outcome for ANY pair of teams must be 0-3, 3-0 or 1-1 Edited by author 22.08.2008 14:21 |
| Help please | Nebojsa | 1485. Football and Lie | 22 Aug 2008 14:16 | 4 |
Can somebody explain me this test input -1 1 0 1 -1 -1 0 1 -1 output 0 0 1 3 0 3 1 0 0 If some captain tells the truth, then for each cell of his row: A[i,j]==-1 || A[i,j] == (bool)B[i][j] If some captain lies, then for each cell of his row: A[i,j]==-1 || A[i][j] != (bool)B[i][j] Matrix B must be such that every pair B[i][j], B[j][i] is one of three forms: 1,1 0,3 3,0 (bool)x = 0 if x=0, and 1 otherwise So, for that test: 1st and 3rd captains lie. The 2nd tells the truth. This is not necessarily the only possible distribution of truths and lies. |
| Optimization | Valentin Pimenov | 1521. War Games 2 | 22 Aug 2008 11:14 | 5 |
Should the interval tree be balanced? I use simple interval tree and get TL22. My program on Pascal with simple interval tree gets AC. I don't understand, what problem with C++ may you have??? I think the problem is in that fact that my 'simple interval tree' is not balanced. So in worst case (N=100000,K=2) I got too long tree. Oh, if you solve it with real tree - of course, it should be balanced! My solution works with interval tree - RSQ, so it is quite fast... I get TLE 15 with circular linked list; His trees aren't definitely good; |
| I've got WA on problem №1110. How can I attach this problem to title "задача" | practicant | | 21 Aug 2008 22:03 | 1 |
Here is my code. Please help to find mistake. #include <stdio.h> void main() { int x,n,m,y,p,i,s,u; vv: scanf("%d",&n); scanf("%d",&m); scanf("%d",&y); if (n<=0 || n>=999 || m<=1 || m>=999 || y<=0 || y>=99) goto vv; u=-1; s=0; x=0; while (x<=(m-1)) { p=1; for (i=1; i<=n; i++) { p=p*x; } if ((p % m) == y) { printf("%d ",x); s++; } x++; } if (s==0) printf("%d\t",u); } |
| clarification | Korduban [Kiev] | 1543. Dance Revolution | 21 Aug 2008 21:06 | 5 |
What range have 1st step? For example, for MEDUIM (period == 500) is it [0..499] or [0..500] ? The same question for last step: [Tmax-perion, Tmax-1] or [Tmax-period,Tmax] ? And, output is defined incorrectly a bit: "In the first line output the number of “PERFECT” step-periods, ..." - any word about word "Perfect" in output. Follow the format, described in sample. Range is of couse [0;500) It's quite obvious. We have only three logical possibilities for that: [0;500] is ambiguous because it overlaps with [500;1000]. (0;500), [0;500) and (0;500] can be tested vs. input. |
| If you have WA9 | Denis Koshman | 1543. Dance Revolution | 21 Aug 2008 21:01 | 1 |
Dance Level Bonus is 0 if Dance Points were negative at any stage during the game (even if final value is non-negative). It's not quite logical because first MISS/BOO ruins bonus for entire game, even if the rest was PERFECT. But that's it :) |
| Can this be done with O(N) memory ? | Chen Tsung | 1145. Rope in the Labyrinth | 21 Aug 2008 17:20 | 3 |
Can this be done with O(N) memory ? Possibly yes. But in O(N^3) time which is inacceptible. Edited by author 07.09.2008 21:52 |
| TLE on #25(help!!!) | ~Flying Spirit~ | 1354. Palindrome. Again Palindrome | 21 Aug 2008 15:56 | 2 |
#include <iostream> #include <cstring> #include <vector> using namespace std; int main() { char str[20000],str2[10000],str3[10000]; unsigned int len; unsigned int i,j,k; vector<char>check; char ch;
while(gets(str)) { len=strlen(str);
if(len==1) cout<<str[0]<<str[0]<<endl;
else {
for(i=0;i<len;i++) str2[i]=str[len-1-i];
if(strncmp(str,str2,len)==0) { for(i=1;i<=len;i++) { for(j=i;j<len;j++) { ch=str[j]; check.push_back(ch); }
for(j=0;j<check.size();j++) { str2[j]=check[j]; str3[j]=check[check.size()-1-j]; }
if(strncmp(str2,str3,check.size())==0) { for(k=0;k<i;k++) str[len+k]=str[i-k-1];
for(k=0;k<len+i;k++) cout<<str[k]; cout<<endl;
check.clear(); break; } check.clear(); } }
else { for(i=0;i<len;i++) { for(j=i;j<len;j++) { ch=str[j]; check.push_back(ch); }
for(j=0;j<check.size();j++) { str2[j]=check[j]; str3[j]=check[check.size()-1-j]; }
if(strncmp(str2,str3,check.size())==0) { for(k=0;k<i;k++) str[len+k]=str[i-k-1];
for(k=0;k<len+i;k++) cout<<str[k]; cout<<endl;
check.clear(); break; } check.clear(); } } }
}
return 0; } My freind i not c++ but I do at java and AC 0.265 My main function code that while(true){ if(n+1==k-n1)if(ch[n]==ch[k-n1])break; if(n==k-n1)break; if(ch[n]==ch[k-n1]){ n++; n1++; } else{ k1++; n=k1; n1=1; } } |
| 1382 tests are not full | svr | 1382. Game with Cards | 21 Aug 2008 14:07 | 2 |
Potentialy very interesting but with too weak tests problem I got Ac very unexpected on halphway of solution. MY prog can't process test 4 1 2 1 2 1 2 3 4 3 4 3 4 with answer 1 1 1 1 This specific case most interesting case when there are K~100-250 unintersecting circles in given graph. We should build forest consist of such circles and process each tree from the root. Circles are bound throught whome each statement belong. All this situation is unreflected because weak tests. Edited by author 12.02.2007 22:08 Edited by author 12.02.2007 22:09 Edited by author 12.02.2007 22:09 Edited by author 12.02.2007 22:11 There is an easier greedy solution. Edited by author 21.08.2008 16:04 |