| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| I get AC with 2 paths | Platto Pavel | 1220. Stacks | 13 янв 2011 11:35 | 2 |
First, very stupied method: used just 2 arrays for A and B values, 0.609s, 673KB. Second, some hint: used multi-stack and for pointers at next element used unsigned short, 0.031s, 677KB. Sorry, for bad english:-) I used 2 arrays for A and B values and O(n) algorithm |
| C/C++ malloc function doesn`t work | atamachi | | 13 янв 2011 00:12 | 3 |
Hello, I try to solve problem 1209 with allocating memory, but i receive compilation error. --------------------------------------------------------- e2c33114-a1cd-488e-b50b-9a2950afaee7 e2c33114-a1cd-488e-b50b-9a2950afaee7(8) : error C2143: syntax error : missing ';' before 'type' e2c33114-a1cd-488e-b50b-9a2950afaee7(19) : error C2065: 'AA' : undeclared identifier e2c33114-a1cd-488e-b50b-9a2950afaee7(19) : error C2109: subscript requires array or pointer type e2c33114-a1cd-488e-b50b-9a2950afaee7(24) : error C2065: 'AA' : undeclared identifier e2c33114-a1cd-488e-b50b-9a2950afaee7(24) : error C2109: subscript requires array or pointer type e2c33114-a1cd-488e-b50b-9a2950afaee7(30) : error C2065: 'AA' : undeclared identifier e2c33114-a1cd-488e-b50b-9a2950afaee7(30) : error C2109: subscript requires array or pointer type e2c33114-a1cd-488e-b50b-9a2950afaee7(32) : error C2065: 'AA' : undeclared identifier e2c33114-a1cd-488e-b50b-9a2950afaee7(32) : warning C4022: 'free' : pointer mismatch for actual parameter 1 --------------------------------------------------------- Code example: --------------------------------------------------------- #include <stdio.h> #include <malloc.h> int main() { int N; scanf("%d", &N); int *AA = (int *)malloc(N*sizeof(int)); ... ... ... free(AA); return 0; } --------------------------------------------------------- What the matter ? Thank you for answers. Edited by author 12.01.2011 23:44 This is correct code for C++, not for C, because when using C compiler, only forward var declarations are permited { int N = 0; int* AA = NULL; // ... AA = (int*)malloc(..); // etc. } This is correct code for C++, not for C, because when using C compiler, only forward var declarations are permited { int N = 0; int* AA = NULL; // ... AA = (int*)malloc(..); // etc. } I receive this kind of errors again... Compilation errors. ------------------ 311e64be-7d0c-42db-86d6-9276eb18480e(8) : error C2143: syntax error : missing ';' before 'type' 311e64be-7d0c-42db-86d6-9276eb18480e(9) : error C2065: 'AA' : undeclared identifier 311e64be-7d0c-42db-86d6-9276eb18480e(9) : warning C4047: '=' : 'int' differs in levels of indirection from 'int *' 311e64be-7d0c-42db-86d6-9276eb18480e(20) : error C2065: 'AA' : undeclared identifier 311e64be-7d0c-42db-86d6-9276eb18480e(20) : error C2109: subscript requires array or pointer type 311e64be-7d0c-42db-86d6-9276eb18480e(25) : error C2065: 'AA' : undeclared identifier 311e64be-7d0c-42db-86d6-9276eb18480e(25) : error C2109: subscript requires array or pointer type 311e64be-7d0c-42db-86d6-9276eb18480e(31) : error C2065: 'AA' : undeclared identifier 311e64be-7d0c-42db-86d6-9276eb18480e(31) : error C2109: subscript requires array or pointer type 311e64be-7d0c-42db-86d6-9276eb18480e(33) : error C2065: 'AA' : undeclared identifier 311e64be-7d0c-42db-86d6-9276eb18480e(33) : warning C4022: 'free' : pointer mismatch for actual parameter 1 ------------------ Full code ------------------ #include <stdio.h> #include <malloc.h> int main() { int total_zero, count_zero, i, N, K, s; scanf("%d", &N); int* AA = NULL; AA = (int*)malloc(N*sizeof(int)); s = 0; for( ; N > 0; N--){ scanf("%d", &K); total_zero = count_zero = i = 0; while( 1 ){ i++; if(total_zero == count_zero){ count_zero = 0; total_zero++; if(i == K){ AA[s++] = 1; break; } } if(i == K){ AA[s++] = 0; break; } count_zero++; } } for(i = 0; i < s; i++) printf("%d ", AA[i]); fputc('\n', stdout); free(AA); return 0; } ------------------ error C2143: syntax error : missing ';' before 'type' It is very strange. |
| Only some hours to solve it ! I think it's simple problem. Although at the first sight, it's likely hard. | Phan Hoài Nam (Harvey Nash) | 1189. Pairs of Integers | 12 янв 2011 15:27 | 1 |
You can go from last digit to the first (the leftmost digit to the rightmost digit). For example : 302 Considering 2 : There are some possibilities: 0 + 2, 1 + 1, 2 + 0, 6 + 6, 5 + 7 ... (first operant is of the larger number, second operant is of the smaller number). Considering 0 : For each possibilities, you try to find out some possibilities that can be combined to produce 0 : 0 + 0... You can try any combinations to produce 0 if two operants used to produce 2 is equal, if they are different, you only have an only way, it reduce very much calculations). Considering 3 : The last digit, you can stop here and consider whether you have achieved a solution. |
| There is one useful test here | Burunduk1 | 1037. Управление памятью | 12 янв 2011 14:50 | 4 |
It helped me to get AC. Test: 1 + 1 + 1 + 10 . 2 11 . 3 600 + 601 . 1 609 . 2 611 . 3 Right answer: 1 2 3 + + 4 - + - this is giving correct output for me but i am failing in test case 2 why ? can u help this is giving correct output for me but i am failing in test case 2 why ? can u help Thank you very much! I can't get AC without it,either~ |
| Multiple threads | Evgeniy++ | | 11 янв 2011 20:12 | 2 |
Hello! Is it allowed to use multiple threads in solutions? Thank you. Also it would be nice if You write hardware configuration of testing server. Thanks in advance. |
| WA#10 | ZiV | 1222. Chernobyl’ Eagles | 11 янв 2011 11:48 | 5 |
WA#10 ZiV 10 янв 2006 00:14 Edited by author 10.01.2006 12:58 :))))))))) ACM.Krupko_Victor[Ivanovo SPU] 10 янв 2006 01:06 n=3000 answer 1322070819480806636890455259752144365965422032752148167664920368226828597346704899540778313850608061963909777696872582355950954582100618911865342725257953674027620225198320803878014774228964841274390400117588618041128947815623094438061566173054086674490506178125480344405547054397038895817465368254916136220830268563778582290228416398307887896918556404084898937609373242171846359938695516765018940588109060426089671438864102814350385648747165832010614366132173102768902855220001 1322070819480806636890455259752144365965422032752148167664920368226828597346704899540778313850608061963909777696872582355950954582100618911865342725257953674027620225198320803878014774228964841274390400117588618041128947815623094438061566173054086674490506178125480344405547054397038895817465368254916136220830268563778582290228416398307887896918556404084898937609373242171846359938695516765018940588109060426089671438864102814350385648747165832010614366132173102768902855220001 I pass your test, but i can't pass test 10. |
| WA1 on Java. | Muravjev Slava [Samara SAU] | 1027. Снова D++ | 11 янв 2011 02:36 | 1 |
Please, give me tests or hints about test 1!!! Edited by author 11.01.2011 16:16 |
| Thanks to Author! | Oracle[Lviv NU] | 1519. Формула 1 | 10 янв 2011 20:44 | 1 |
I enjoyed solving that problem! Very interesting, thanks a lot. P.S. Answer for empty grid 12x12 = 1076226888605605706 |
| Weak tests | Zayakin Andrey[PermSU] | 1416. Для служебного пользования… | 10 янв 2011 13:28 | 2 |
Weak tests Zayakin Andrey[PermSU] 7 авг 2010 21:59 My O(M*M*log(N)) solution passed. New tests were added. 40 authors lost AC. |
| Show the input with the WA result | Lolmaker | | 10 янв 2011 03:44 | 1 |
Can you show us Input with the Wrong Answer result? |
| Be careful, the last charactor is '.' not ',', this reason lead to 2 WA~ | ZLqiang | 1008. Кодирование изображений | 9 янв 2011 15:19 | 2 |
#include <cstdio> #include <cassert> #include <cctype> #include <utility> #define x first #define y second const int MAX = 16; const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; int N; bool brd[MAX][MAX]; int ref[256]; int main () { char line[16]; gets (line); static std::pair <int, int> q[MAX * MAX]; int p3 = 0; int a, b; int i, j; ref[(int)'R'] = 0; ref[(int)'T'] = 1; ref[(int)'L'] = 2; ref[(int)'B'] = 3; if (sscanf (line, "%d %d", &a, &b) == 2) { q[p3++] = std::make_pair (a, b); brd[a][b] = 1; for (i = 0; i < p3; ++i) { gets (line); for (j = 0; isalpha (line[j]); ++j) { assert (line[j] == 'R' || line[j] == 'T' || line[j] == 'L' || line[j] == 'B'); brd[q[i].x + dx[ref[(int)line[j]]]][q[i].y + dy[ref[(int)line[j]]]] = 1; q[p3++] = std::make_pair (q[i].x + dx[ref[(int)line[j]]], q[i].y + dy[ref[(int)line[j]]]); } } assert (line[j] == '.'); printf ("%d\n", p3); for (i = 1; i < MAX; ++i) for (j = 1; j < MAX; ++j) if (brd[i][j]) printf ("%d %d\n", i, j); } else { N = a; for (i = 0; i < N; ++i) { scanf ("%d %d\n", &a, &b); if (i == 0) q[p3++] = std::make_pair (a, b); else brd[a][b] = 1; } printf ("%d %d\n", q[0].x, q[0].y); for (i = 0; i < p3; ++i) { for (j = 0; j < 4; ++j) { if (brd[q[i].x + dx[j]][q[i].y + dy[j]]) { putchar ("RTLB"[j]); brd[q[i].x + dx[j]][q[i].y + dy[j]] = 0; q[p3++] = std::make_pair (q[i].x + dx[j], q[i].y + dy[j]); } } if (i == N - 1) putchar ('.'); else putchar (','); puts (""); } } return 0; } |
| To admins. C# is broken. | Progbeat | | 9 янв 2011 05:34 | 4 |
Any program written on C# gets OLE (unless it gets CE). Fixed Vladimir Yakovlev (USU) 9 янв 2011 05:34 |
| All the test(To 5) | Fadeev.E.V | | 8 янв 2011 22:18 | 1 |
Can explain please that tests - 1, 2, 3, 4, 5 mean.То there is what childbirth of errors they reveals. |
| Maybe it can help someone | Yevgeniy | 1004. Экскурсия | 7 янв 2011 18:51 | 2 |
5 6 1 5 1 3 5 100 3 4 2 2 4 1 4 5 10 1 2 1 Answer: 1 2 4 5 thank you very much, I got an AC |
| Problem 1034 "Queens in Peaceful Positions". New tests were added. (+) | Sandro (USU) | 1034. Ферзи в мирной позиции | 7 янв 2011 00:24 | 1 |
50 authors lost AC after rejudge. |
| Good problem. Use only integer calculations | Серовиков Андрей | 1679. Башня дядюшки Скруджа | 6 янв 2011 17:38 | 5 |
I tried to solve with some float precisions but it was always WA. Then it was written using only integer calculations and AC. But integer solution really nice ;) I think that integer method is nice because it mathematically easy proved Float method has only timus-Ac verification and there for less nice. I tried to find regorious analysis of some float algo based on computer float system theory but it is rather difficult. I totally agree - very interesting problem with integer solution. |
| I CAN"T UNDERSTAND THIS PROBLEM | Micheal Jackson | 1538. Сторожевые башни | 6 янв 2011 15:51 | 1 |
So, if the pigeon is black or white, how does this work? Edited by author 06.01.2011 15:52 |
| question about C++ | hoan | | 6 янв 2011 14:54 | 1 |
const int MAXN= (1 << 23); struct bits{ bool mark : 1; }a[MAXN]; this code use 1MB memory or 8MB memory??? thanks in advance! |
| Accepted in java with only 1 sec....&786kb :-) | Varun Kumar(Fundu) | 1528. Sequence | 6 янв 2011 11:35 | 2 |
Edited by author 23.10.2008 17:35 Edited by author 23.10.2008 17:35 I accepted in 0.75 sec and 188 KB in C++ |
| Test #4 | Ruben Alanakyan | 1014. Произведение цифр | 6 янв 2011 01:46 | 10 |
Test #4 Ruben Alanakyan 29 окт 2007 01:39 Edited by author 29.10.2007 01:40 It's test with '0' in input, you need to print '10' for it not '0' I think it is better to exclude "0" from {Q} because AFAIK it is not decided whether 0 is positive or a "number without a sign". Why? Why isn't the minimal product just "0"? Do you have to have two digits ta make a product or what is the test really? Quote: "Your task is to find the minimal POSITIVE integer number Q so ...." Edited by author 19.02.2010 18:25 Re: Test #4 Mikael Arakelyan(ERIICTA) 23 ноя 2010 20:47 mikael@ubuntu:~/Desktop$ ./xx 1 1 mikael@ubuntu:~/Desktop$ ./xx 0 10 mikael@ubuntu:~/Desktop$ ./xx 2 2 mikael@ubuntu:~/Desktop$ ./xx 3 3 mikael@ubuntu:~/Desktop$ ./xx 4 22 mikael@ubuntu:~/Desktop$ ./xx 5 5 mikael@ubuntu:~/Desktop$ ./xx 6 23 mikael@ubuntu:~/Desktop$ ./xx 8 24 mikael@ubuntu:~/Desktop$ ./xx 9 33 mikael@ubuntu:~/Desktop$ ./xx 10 25 mikael@ubuntu:~/Desktop$ ./xx 20 45 mikael@ubuntu:~/Desktop$ ./xx 25 55 mikael@ubuntu:~/Desktop$ ./xx 30 56 mikael@ubuntu:~/Desktop$ ./xx 45 59 mikael@ubuntu:~/Desktop$ ./xx 60 256 mikael@ubuntu:~/Desktop$ ./xx 105 357 mikael@ubuntu:~/Desktop$ ./xx 108 269 mikael@ubuntu:~/Desktop$ Re: Test #4 Mikael Arakelyan(ERIICTA) 23 ноя 2010 20:48 mikael@ubuntu:~/Desktop$ ./xx 4 22 this is wrong should be 4 4 22 this is wrong should be 4 yeah this is wrong the minimal for 4 is 4 Edited by author 06.01.2011 01:47 |