| Show all threads Hide all threads Show all messages Hide all messages |
| Problem 'bout Hash.. (|8-1 | yangdong | 1196. History Exam | 21 Oct 2010 22:27 | 2 |
I've seen a discussion that gave a Hash Function .... as this: x& 2^31 but As the writer say..the tests are too weak..got AC Is there any better Hash?...like ELF in string Hash.. touch me Please. Edited by author 21.10.2010 13:37 These should be better: string s; longint x:=0; for i:=1 to lenght(s) do x:=s[i]+(x shl 6) + (x shl 16) -x; or longint b:=3737 or b:=1717 x:=0; for i:=1 to length(s) do begin x:=x*b; x:=x+s[i]; end; Edited by author 21.10.2010 22:30 Edited by author 21.10.2010 22:33 Edited by author 21.10.2010 22:35 |
| I'm mad | Mato_No1 | 1057. Amount of Degrees | 21 Oct 2010 15:17 | 4 |
Why does my program always get WA#1? I have tried all the tests in the forum, and all of them are correct. I think there is a very strange mistake in my program. #include <stdio.h> #define re(i, n) for (int i=0; i<n; i++) #define rre(i, n) for (int i=n-1; i>=0; i--) const int MAXN = 32; int b, k; long long c[MAXN][MAXN], res = 0; void prp(void) { re(i, MAXN) re(j, MAXN) if (i < j) c[i][j] = 0; else if (!j) c[i][j] = 1; else c[i][j] = c[i - 1][j - 1] * i / j; } long long xxx(long long v) { int a[MAXN], len = 0; long long r0 = 0; while (v) {a[len++] = v % b; v /= b;} int k0 = k; rre(i, len) { int x = a[i]; if (x >= 2) {r0 += c[i + 1][k0]; break;} if (x) {r0 += c[i][k0]; k0--;} } return r0; } int main(void) { long long s, t; scanf("%lld%lld%d%d", &s, &t, &k, &b); prp(); res = xxx(t + 1) - xxx(s); printf("%lld\n", res); return 0; } Edited by author 04.09.2010 20:07 I know where the mistake is. If "k0" is less than 0, it must exit. Now I got AC. The test is: 1 30 2 2 --> 10 Right! Right! you must book ticket to madhouse, ok? |
| No 0 EXI | yangdong | 1023. Buttons | 21 Oct 2010 09:38 | 1 |
In my pgm there's no '0'... At least we can print(n-1) :) |
| allright | airlord | 1225. Flags | 21 Oct 2010 01:10 | 1 |
Edited by author 21.10.2010 01:16 |
| a+b? | cccp | 1000. A+B Problem | 20 Oct 2010 23:46 | 4 |
a+b? cccp 15 Mar 2009 08:13 #include<iostream> using namespace std; int main() { int sum=0,a; cin>>a; sum+=a; cin>>a; sum+=a; cout<<sum<<endl; return 0; } in place of int used long Good luck! Re: a+b? HUMOYUN_220-10 13 Oct 2010 14:41 #include <stdio.h> int main() { int a, b; scanf("%d%d", &a, &b); printf("%d\n", a + b); return 0; } |
| What's up?=( | Roman Furko | 1261. Tips | 20 Oct 2010 23:13 | 2 |
I can't take a[0..25000000]of boolean; Memore Limit? Why? This Massive is only max 15 mb No, because boolean variables are represented as a size of 1 byte memory locations. So size of your array is nearly 25Mb. |
| New tests were added. Thanks to Fedor Fominykh and Mikhail Rubinchik.(-) | Sandro (USU) | 1790. Searching for the Truth | 20 Oct 2010 16:32 | 1 |
|
| Week tests | Orfest (Novosibirsk SU) | 1323. Classmates | 20 Oct 2010 16:06 | 5 |
Week tests Orfest (Novosibirsk SU) 20 Oct 2010 10:43 My solution works 5.5 sec on the following test. I believe my computer is faster than yours. So, please add this test and make me lose AC. 10 27 a b a c a d a e a f a g a h a i a j d h d i d j e f e g e h e i e j f g f h f i f j g h g i g j h i h j i j a Why did you add the test which is not formatted correctly ? I had go to my old pascal code, install some compiler for it and then it appears that the input format of that test is incorrect and that's why my solution fails. |
| Yet another way to solve | melkiy | 1220. Stacks | 20 Oct 2010 06:45 | 1 |
It seems someone have suggested to hold a common memory segment for all stacks. Here is my way to solve with some details. Allocate a large array - a common segment for all stacks, and define the size of a block. int a[BLOCKS*BLOCK_SIZE]; Each block stores (BLOCK_SIZE-1) cells for the numbers and one cells to link it with the previous block for the stack. Also it is useful to have a bit map reflecting if a particular block is occupied. Make functions find_free_block and release_block. Also i was needed a couple of arrays of int[1000]. When the next stack grows above (BLOCK_SIZE-1)*k, the new block is occupied and the stack's memory becomes BLOCK_SIZE*(k+1). On the other hand, when i can release a block after POP i do this for memory reuse. It was found experimetally at the price of 5 MLE attempts that acceptable parameters are: BLOCKS = 3200; //number of blocks BLOCK_SIZE = 50; //integers, not bytes |
| It is very easy just make topogical sort!!!!!!! | Tigran92[RAU] | 1022. Genealogical Tree | 19 Oct 2010 18:57 | 1 |
|
| hint: wa13 | ASK | 1332. Genie Bomber | 19 Oct 2010 03:24 | 1 |
Apparently, the first 12 tests are complete crap: I passed them using dx instead of dy and hypotenuse length instead of leg length. So the hint is to check your program for stupid mistakes. |
| Simple Testcase | Alexander Georgiev | 1791. Uncle Styopa and Buses | 19 Oct 2010 00:08 | 1 |
Be sure to pass the following testcase: 6 1 10 1 10 1 10 1 10 1 10 6 3 1 4 1 |
| I am sure that there is no test in which we must output NO!!!! | Tigran92(Rau) | 1107. Warehouse Problem | 18 Oct 2010 23:38 | 1 |
|
| Whats wrong with my formula? | Dijkztra | 1142. Relations | 18 Oct 2010 18:12 | 3 |
z = fact(z)/(2*pow(log(2),n+1)); if(fmod(z,1)>=0.5) z = floor(z) + 1; else z = floor(z); I tried the example test case and got true, but got WA with 1st test case... T_T I sent your formula and got AC. Try to output answer so: cout << fixed << setprecision(0) << z; or so: printf("%.0lf",z); And you must use double instead of float function g(x,k:longint):comp; var i:longint; q:comp; begin q:=1; for i:=1 to k do q:=q*i; g:=q*x; end; var f:array[0..20,0..20] of longint; a:array[0..20] of comp; i,j,n,k:longint; begin for i:=0 to 10 do begin f[i,1]:=1; f[i,i]:=1; end; f[0,1]:=0; for i:=1 to 10 do for j:=2 to i-1 do f[i,j]:=f[i-1,j-1]+f[i-1,j]*j; for i:=2 to 10 do for j:=1 to 10 do a[i]:=a[i]+g(f[i,j],j); readln(n); while n>0 do begin writeln(a[n]:0:0); readln(n); end; end. |
| WA 13 | delin | 1786. Sandro's Biography | 18 Oct 2010 18:03 | 2 |
WA 13 delin 17 Oct 2010 03:14 Re: WA 13 QAFQAZSehriyarNovruzov 18 Oct 2010 18:03 try this test jkhdSaFKrojkllSafkroppp answer 10 at first my answer is 20.I saw my bug with this test. you must find max the same letter with "Sandro" and max lowercase letter. Edited by author 18.10.2010 18:04 Edited by author 18.10.2010 18:04 Edited by author 18.10.2010 18:07 Edited by author 18.10.2010 18:08 |
| WA 12 | okulov-nikolay | 1791. Uncle Styopa and Buses | 18 Oct 2010 13:37 | 1 |
WA 12 okulov-nikolay 18 Oct 2010 13:37 |
| How to write 0.001 solution | Nguyen Khac Tung | | 18 Oct 2010 08:03 | 5 |
My best time for most programs is 0.015 at least. I see lots of 0.001s exec time . Can share how to write one ? Even the easiest problem A+B It was possible only in 2008 and earlier. Why so? More complicated tests were added? Admins can tell you. I think it's because hardware has been changed. |
| No subject | Tudor Siminic | 1794. Masterpieces of World Architecture | 17 Oct 2010 17:24 | 1 |
Can someone give me test 6? |
| I use greedy method to choose loop in the order of DFS.But I've just found a peculiar test case that DFS will be incorrect.Is greedy method right here? | Huang Yizheng | 1077. Travelling Tours | 17 Oct 2010 13:10 | 4 |
For example: 7 10 1 2 2 3 2 4 2 5 3 5 4 5 5 6 5 7 6 7 1 7 At first the DFS procedure find the loop: (1,2,3,5,6,7,1),then it'll find (1,2,3,5,7,1). and next,no loop with unused edge will be found!?! In fact,the maximum T is 3(it's obvious),but use greedy method + DFS the number of T only reach 2. Unless we regulated the order of search (it means DFS can't be right!),otherwise we have to delete a found loop to let more loop to have unused edge,then how to make the regulations? Sorry, for this example, the correct output is T = 4 !!! Check your algorithm again !!! mailto : trungduck@yahoo.com > For example: > 7 10 > 1 2 > 2 3 > 2 4 > 2 5 > 3 5 > 4 5 > 5 6 > 5 7 > 6 7 > 1 7 > At first the DFS procedure find the loop: > (1,2,3,5,6,7,1),then it'll find (1,2,3,5,7,1). > and next,no loop with unused edge will be found!?! > In fact,the maximum T is 3(it's obvious),but use greedy > method + DFS the number of T only reach 2. > Unless we regulated the order of search > (it means DFS can't be right!),otherwise we have to > delete a found loop to let more loop to have unused > edge,then how to make the regulations? > > Once DFS loop is found, it ALWAYS contains unused edge - e.g. the edge which looped it in :) Edited by author 17.10.2010 13:22 Edited by author 17.10.2010 13:22 |
| WA10 | Sergey | 1038. Spell Checker | 17 Oct 2010 03:05 | 2 |
WA10 Sergey 12 Mar 2010 20:09 Hello, i try send my programm but always get some WA. Can you explaint few things. First: In END of input ".?!"? When i added check for it i get 1WA. Second: "ssss[S]ssss" r there mistake? When i check for it i get 2WA Third: When i delete this conditions i get 10WA. Im confused. I've readed all threads and added conditions for every case which i found. What in 10 test? I guess the 10-th test checks for your attintive reading of the condition: "1. The first LETTER in a sentence is small." For example, the text "Hello! 238 my Friend" has an error, because the first letter in the second sentence is NOT the digit '2' but the letter 'm' which must be capital. |