| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| why WA17????????????????????????????????????????????????????? | CHIDEMYAN SERGEY | 1534. Гондорский футбол | 8 мар 2007 23:08 | 7 |
#include <iostream.h> int main(){ unsigned long k,l,n,sumM=0,i,kk,ll,g1,g2;cin>>k>>l>>n;kk=k;ll=l; for(i=0;i<n;i++){ g1=0;g2=0; if(kk>0&&i!=(n-1)){ g1=1;kk--; } else if(i==(n-1)){ g1=kk;g2=ll; //cout<<kk<<" "<<ll<<" "<<i<<endl; } if(g1>g2){ sumM+=3; } else if(g1==g2) { sumM+=1; } } cout<<sumM<<" "; /*sumM=0;kk=l;ll=k; for(i=0;i<n;i++){ g1=0;g2=0; if(kk>0&&i!=(n-1)){ g1=1;kk--; } else if(i==(n-1)){ g1=kk;g2=ll; //cout<<kk<<" "<<ll<<" "<<i<<endl; } if(g1<g2){ sumM+=3; } else if(g1==g2) { sumM+=1; } } cout<<sumM;*/ sumM=0;kk=k;ll=l; for(i=0;i<n;i++){ g1=0;g2=0; if(kk!=ll&&ll>0&&i!=(n-1)){ g2=1;ll--; } else if(i==(n-1)){ g1=kk;g2=ll; //cout<<kk<<" "<<ll<<" "<<i<<endl; } if(g1>g2){ sumM+=3; } else if(g1==g2) { sumM+=1; } } cout<<sumM;
return 0; } Try test 40446 59850 50506, I think yr output is wrong are answers 131397 31102?thank! My AC program gives 131397 3 THANK!I THINK I HAD PROBLEMS WITH MINIMAL POINTS IN OUTPUT. Test: 40446 59850 50506 My solution: 131397 3 No, WA 17... ??? |
| OOOOOOOOh! I hate this problem! | CF# {Anoshin,Sotov,Khuramshin} | 1334. Шашки | 8 мар 2007 21:34 | 1 |
Stupid, stupid task with wrong, wrong tests! Why checkers can go out of a desc, why nobody sad that there could be move after the last 32'th step? Why just not to tell everyone rules of the game in the text of the problem? Edited by author 08.03.2007 21:35 |
| What is the answer? (+) | Samsonov Alex [USU] | 1532. Трудности перевода | 8 мар 2007 16:30 | 3 |
What is the correct answer for this test: 4 aaaaaa bbaaaa bbccaa bbccdd Does it contain 3 or 4 words? 4 (-) Ivankov Dmitry 8 мар 2007 15:22 |
| question | Rostislav | 1529. Game of Squares | 8 мар 2007 14:51 | 5 |
What do you mean by: " It is required that at least one of those small parts has edge lengths that are pairwise relatively prime with the corresponding edge lengths of the original parallelepiped. " and is it allowed to make the following cut in the second example ? 1 1 3 If we have such a cut (which I think is correct) then we will have two equal cubes(2 3 2) (i.e. this move is correct and the first player can win by it), or I am wrong?
Rostislav Thank's Edited by author 18.02.2007 16:51 Edited by author 18.02.2007 17:24 Please answer :) because I am can't get it. My AC program outputs 1 1 3. Sample output is incorrect. Yes, the rigth answer is 1 1 3. |
| I dont' understand | Loky_Yuri [USTU Frogs] | 1236. Decoding Task | 8 мар 2007 13:59 | 3 |
In the task said "The first line consists of 2N characters and represents the encoded message N bytes long". But I understood that if we encode the message length of n, we will receive message the same length (n). Whats wrong? Each byte can be presented as 2 characters in a hexadecimal form 0 - 00 1 - 01 .. 16 - 10 .. 255 - FF so n bytes = 2*n characters Thank you! Now I'll try to solve it! |
| be careful with gets(...) when i replace it by scanf("%s",..) a got AC | Alias aka Alexander Prudaev | 1002. Телефонные номера | 8 мар 2007 00:11 | 2 |
maybe inut files has some extra spaces (surplus)... They don't. Notice that gets() adds '\n' symbol to the end of line when you reopen stdin, just like fgets(). I spent so much time to fix this mistake :( |
| WA12????????? | RAVEman | 1522. Factory | 7 мар 2007 23:18 | 1 |
what is that test? none of my solutions can pass it. Please give me some hints!!! |
| WA 10.People help me plz!!!!!!!!!!! | Серовиков Андрей | 1201. Какой сегодня день? | 7 мар 2007 22:00 | 7 |
I have WA on test 10. Could anybody give me this test. What a strange advice? I have WA10 also during a long time but how van I use 1 30 2012? I see 30>12 I must apolojize and be gratful to previous messenger Because on test 30 1 2012 my prog was making bad picture and after correction I got Ac. mon 2 9 16 23 [30] tue 3 10 17 24 31 wed 4 11 18 25 thu 5 12 19 26 fri 6 13 20 27 sat 7 14 21 28 sun 1 8 15 22 29 Where is the error here? 6 digital columns. Hmmm.. Edited by author 07.03.2007 01:58 Edited by author 07.03.2007 01:58 mon........2....9...16...23..[30] tue........3...10...17...24...31 wed........4...11...18...25..... thu........5...12...19...26..... fri........6...13...20...27..... sat........7...14...21...28..... sun...1....8...15...22...29..... Spaces must be under control also. This problem is typical for beginning of 2000-s when frequently used statements descriptions "po ponjatiam" or without full descriptions thinking that common sense is part of coders skills. Thank you very much! When i test my program on it, i get wa, because in one place i had < instead of <=. After correction - AC!! Thanks.. Edited by author 07.03.2007 22:00 |
| help me with c# problem 1000 | Konstantin | 1000. A+B Problem | 7 мар 2007 21:30 | 1 |
i can not understud why my program get crash. But on my computer it works! this is the source code: //////////////////////////////////// using System; class MAIN { public static int Main() { int a, b; a = Int32.Parse(Console.ReadLine()); b = Int32.Parse(Console.ReadLine()); Console.WriteLine(a+b); return 0; } } ///////////////////////////// |
| This can be solved without any deep math knowledge ! (and very fast) | Ostap Korkuna (Lviv NU) | 1132. Квадратный корень | 7 мар 2007 18:23 | 2 |
I've passed this problem with time 0.125 ! And the only mathematical conclusion I used is that when x is a square root then (n-x) is also. I am sure that the mathematical approach to this problem is also interesting (and probably harder than mine) but it was still very interesting for me to find the way to solve this problem without using of deep math knowledge. It is also interesting that my solution runs faster then some implementing the math approach :-) but still I use much more memory... http://acm.timus.ru/status.aspx?space=1&num=1132&author=30467 Thanks to mr. Medvedev for this problem. program Ural_1132; var i,j,x,p,q,n:longint; function power(a,b,c:longint):longint; var d,s:longint; begin d:=a;s:=1; while b>0 do begin if odd(b) then s:=(s*d) mod c; b:=b div 2;d:=(d*d) mod c; end; exit(s); end; begin read(n); for i:=1 to n do begin read(q,p);q:=q mod p; if (p=2) and (q=1) or (p<>2) and (power(q,(p-1) div 2,p)=p-1) then begin writeln('No root'); continue; end; if trunc(sqrt(q))=0 then begin x:=trunc(sqrt(q)); write(x); if p-x<>x then write(' ',p-x); writeln; continue; end; for j:=1 to (p-1) div 2 do begin x:=(j*j) mod p; if x=q then begin write(j); if p-j<>j then write(' ',p-j); writeln; break; end; end; end; end. Edited by author 07.03.2007 18:27 |
| Help! Where's my error? | Alexander Kosmynin | 1131. Копирование | 7 мар 2007 17:44 | 1 |
var t,c,i,n,k:integer; begin read (n,k); i:=1; while i<n do begin If c<k then c:=c+1; i:=i+c; t:=t+1; end; If n=-1 then t:=-1; writeln (t); end. Edited by author 12.09.2007 19:47 |
| clarification | MessedUp | 1529. Game of Squares | 7 мар 2007 17:00 | 4 |
If one of the dimensions becomes one, do we continue with an (k-1)-dimensional problem, or does every cut remove all blocks? In either case, can someone give me some sample I/O, since I currently get WA #3 (assuming the first two are the sample cases). If one of the dimensions becomes one, do we continue with an (k-1)-dimensional problem, or does every cut remove all blocks? Second way, k is constant during computations. Finally, some tests: 2 11 12 3 6 7 8 4 5 6 7 8 and answers: 1 4 1 1 1 2 4 1 1 1 2 4 Thanks, I've found my stupid error (using a global variable in an recursive function). Now I got TLE on test 4, but I'll work on that later. Consider case K = 1 severally |
| WA#8 | Duzhy Igor | 1537. Энты | 7 мар 2007 12:39 | 6 |
WA#8 Duzhy Igor 5 мар 2007 12:03 I think, it's a simple recursion. If N is even, then f(N)=f(N-1)+f(N/2) else if N is odd, then f(N)=f(N-1) Am I right? mod P also important espacially if P==1 I count it at the end before the output. There is my code: #include <iostream> using namespace std; __int64 FindAnswer(const __int64 &num); int main(void) { // Input data __int64 K, P; cin >> K >> P; // Outputs the result cout << (FindAnswer(K)%P) << endl; return 0; } // Function finds the answer __int64 FindAnswer(const __int64 &num) { if(num==2) return 1; if(num<2) return 0; if(num%2) return num/2; return FindAnswer(num-1) + FindAnswer(num/2); } It should to combine recursion and Dynamic prog. At the beggining build array F1[10000000] using formula and from K>10000000 go by recursion not to 1 as you but only to first value in [1..10000000] But %P we must make in FindAnswer befor return or we will have overflow and i don't understand conditiom if (num%2) must be if (num%2==0) Re: WA#8 KirillB(Arkhangelsk - PomorSU) 5 мар 2007 16:50 To Duzhy Igor Your solution has non polynomial complexity Why you are using this way Just fill array[2..10000000] from 2 to k using your formula at the end out (mas[k]%p) Edited by author 05.03.2007 17:00 Thank you very much, I have solved it. Good luck!!! |
| No subject | Shady TKTL | | 7 мар 2007 12:19 | 1 |
|
| WA #7 | Shady TKTL | 1013. K-ичные числа. Версия 3 | 7 мар 2007 10:35 | 1 |
WA #7 Shady TKTL 7 мар 2007 10:35 Can somebody give me some tests (hard tests) |
| FOR ADMINS!!!!!!! | XAMelleOH | 1534. Гондорский футбол | 7 мар 2007 02:14 | 6 |
In my opinion, the tests for this problem are not good enough, because incorrect solutions pass system tests. For example, the solution that outputs "4 4" for test "1 1 3" is succesfully passing systests and have AC, but the correct answer is "4 3"!!! Sorry for my English :) Edited by author 05.03.2007 21:11 My program write "4 3" too... Thank you! Your test was added to the test set. If you have more tricky tests, you are welcome. Yes, I have. [Code deleted] :)
I have deleted these tests for other participants not to make solutions expressly for these tests. Edited by author 08.03.2007 04:59 Some more tests were added. 9 submits lost AC verdict. I don't know what i can say... My program lost status AC... Edited by author 09.03.2007 17:45 |
| test 8 | RAVEman | 1455. Свобода слова | 6 мар 2007 22:45 | 1 |
test 8 RAVEman 6 мар 2007 22:45 what is the 8th test? thanks! |
| wrong sample | Yashar Abbasov | 1535. Хоббит или Туда и обратно | 6 мар 2007 18:37 | 4 |
I think you gave wrong sample test for n=4 min is not 1 4 2 3 it is 4 1 2 3 because 1*4+4*2+2*3=18 but 4*1+1*2+2*3=12 You are wrong. Read the task more carefully. You are wrang, becouse 1*4+4*2+2*3+3*1 = 21, 4*1+1*2+2*3+3*4 = 24. And moreover, the sequence must start with 1. |
| please explain the example for me | Viktorianka | 1540. Битва за кольцо | 6 мар 2007 17:10 | 2 |
thie example: 3 1 2 1 1 1 answer 1 1 if G choose the first ring from the first row, then the first row will be dematerialised, because there is 3 and all numbers of the first row <=3. So S will win in the next move. Read the statement more carefully: "Each of the next K lines describes the corresponding chain in the following format: the first number is the length of the chain" So 3 is the number of elements in the first chain. |
| Who Can Help ME? | David Sun | 1182. Team Them Up! | 6 мар 2007 15:26 | 2 |
WA On Test #16 #include <stdio.h> #include <memory.h> #include <stdlib.h> #define max(a, b) (a) > (b) ? (a) : (b) bool link[101][101]; int n; int main(void){ memset(link, false, sizeof(link));
scanf("%d", &n); for (int i = 1; i <= n; i++){ int next; scanf("%d", &next); while (next != 0){ link[i][next] = true; scanf("%d", &next); } }
for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ if (!link[i][j] || !link[j][i]){ link[i][j] = link[j][i] = true; } else { link[i][j] = link[j][i] = false; } } }
bool vis[101]; memset(vis, false, sizeof(vis)); int blocks[101][101][2], blocks_size[101][2], blocks_count = -1; for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ //??????????? if (link[i][j] && !vis[i]){ int queue[2][101], queue_size[2], head[2]; queue_size[0] = queue_size[1] = 0; head[0] = head[1] = 0; queue[1][0] = i; vis[i] = true; queue[0][0] = j; vis[j] = true; while (head[0] <= queue_size[0] || head[1] <= queue_size[1]){ if (head[0] <= queue_size[0]){ int point = queue[0][head[0]]; for (int k = 1; k <= n; k++){ if (link[point][k] && !vis[k]){ queue[1][++queue_size[1]] = k; vis[k] = true; } } head[0]++; }
if (head[1] <= queue_size[1]){ int point = queue[1][head[1]]; for (int k = 1; k <= n; k++){ if (link[point][k] && !vis[k]){ queue[0][++queue_size[0]] = k; vis[k] = true; } } head[1]++; } }
for (int k = 0; k <= queue_size[0]; k++){ for (int l = k + 1; l <= queue_size[0]; l++){ if (link[queue[0][k]][queue[0][l]]){ printf("No solution\n"); getchar(); getchar(); getchar(); getchar(); return 0; } } }
for (int k = 0; k <= queue_size[1]; k++){ for (int l = k + 1; l <= queue_size[1]; l++){ if (link[queue[1][k]][queue[1][l]]){ printf("No solution\n"); getchar(); getchar(); getchar(); getchar(); return 0; } } }
blocks_count++; blocks_size[blocks_count][0] = queue_size[0]; blocks_size[blocks_count][1] = queue_size[1]; for (int k = 0; k <= queue_size[0]; k++) blocks[blocks_count][k][0] = queue[0][k]; for (int k = 0; k <= queue_size[1]; k++) blocks[blocks_count][k][1] = queue[1][k]; } } }
for (int i = 1; i <= n; i++){ if (!vis[i]){ blocks_count++; blocks_size[blocks_count][0] = 0; blocks_size[blocks_count][1] = -1; blocks[blocks_count][0][0] = i; vis[i] = true; } }
bool status[101], status_x[101]; bool way[101][101], way_x[101][101]; memset(way, false, sizeof(way)); memset(status, false, sizeof(status)); status[0] = true; for (int i = 0; i <= blocks_count; i++){ memset(way_x, false, sizeof(way_x)); memset(status_x, false, sizeof(status_x)); for (int j = 0; j <= n / 2; j++){ if (status[j]){ if (!status_x[j + blocks_size[i][0] + 1] && j + blocks_size[i][0] + 1 <= n / 2){ status_x[j + blocks_size[i][0] + 1] = true; memcpy(way_x[j + blocks_size[i][0] + 1], way[j], sizeof(way_x[j + blocks_size[i][0] + 1])); for (int k = 0; k <= blocks_size[i][0]; k++){ way_x[j + blocks_size[i][0] + 1][blocks[i][k][0]] = true; } }
if (!status_x[j + blocks_size[i][1] + 1] && j + blocks_size[i][1] + 1 <= n / 2){ status_x[j + blocks_size[i][1] + 1] = true; memcpy(way_x[j + blocks_size[i][1] + 1], way[j], sizeof(way_x[j + blocks_size[i][1] + 1])); for (int k = 0; k <= blocks_size[k][1]; k++){ way_x[j + blocks_size[i][1] + 1][blocks[i][k][1]] = true; } } } } memcpy(way, way_x, sizeof(way_x)); memcpy(status, status_x, sizeof(status_x)); }
for (int i = n / 2; i >= 1; i--){ if (status[i]){ printf("%d", i); for (int j = 1; j <= n; j++){ if (way[i][j]) printf(" %d", j); }
printf("\n%d", n - i); for (int j = 1; j <= n; j++){ if (!way[i][j]) printf(" %d", j); } }
break; }
getchar(); getchar(); getchar(); getchar(); } Sorry, I've made some silly mistakes. I'll try to do better next time. Thanks! |