Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | I cant understand the problems!!!! | Xudong_LI | 1092. Трансверсаль | 2 янв 2017 23:36 | 2 | Could someone tell me what's the meaning of this problem?my english is noot good.The google translation is bad. let: 2D array[N][N], and transversal is a cells of N , which for each row and each column has one cell in the transversal. for example: 2D array: 1) 2) 3) ============= 1)| 1 2 3 2)| 4 5 6 3)| 7 8 9 transversal-1: { (1;1) , (2;2) , (3;3) } // (row, col) -- coordinate of a cell, . transversal-2: { (1;1) , (2;3) , (3;2) } transversal-3: { (1;2) , (2;1) , (3;3) } transversal-4: { (1;2) , (2;3) , (3;1) } transversal-5: { (1;3) , (2;1) , (3;2) } transversal-6: { (1;3) , (2;2) , (3;1) } Note that, there 1*2*3...*N = N! different transversals exist. Now, about problem: 2D array with 2N+1 x 2N+1 size , elements '+' or '-'. And allowed operation: can change sign to opposite in all cells in a transversal. You are asked to determine if it is possible to obtain a table containing not more than 2N cells with the sign "+" by a sequence of such operations Good Luck!
| | Algorithm ! AC 0.031 | Phan Hoài Nam (HUFLIT) | 1097. Квадратная страна 2 | 2 янв 2017 23:12 | 4 | Split your land and get smaller lands ! First, you have a land (1,1)(n,n) For example: Your land: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 after adding the land with maximal importance: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 9 1 1 1 1 9 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 You have 4 new lands: 2 lands: a a a a a a a a a a a a 1 1 9 9 1 1 1 1 9 9 1 1 a a a a a a a a a a a a and 2 lands: a a 1 1 a a a a 1 1 a a a a 9 9 a a a a 9 9 a a a a 1 1 a a a a 1 1 a a For each of your new lands, you continue add other lands with decreasing importance. Finally, you will find out that after adding a land with a certain importance t, you can't create a land with desired park size. Now, you end your program and output t. THE END ^^! Edited by author 08.10.2010 14:39 Edited by author 12.10.2010 10:14 Hmmm.... I've tried this strategy using BFS and got ML3. Using recursion TL3. So probably i'm missing something. here is pseudo code for my recursive solution int findMin(List<Rectangle> lands, Rectangle area, int startFrom) { if (minSide(area) < regionSize) return startFrom - 1; Rectangle land = firstLandThatIntersectsArea(lands, area, startFrom); if (land == null) return 1; findMin(lands, top(area, land), indexOf(land) + 1); findMin(lands, right(area, land), indexOf(land) + 1); findMin(lands, bottom(area, land), indexOf(land) + 1); findMin(lands, left(area, land), indexOf(land) + 1); } call findMin(sortedDescByPriority(lands), new Rectangle(1, 1, n, n), 0); Send me the code, please! goldenxbullet@gmail.com Thanks! Algorithm! AC 0.001 1. use buffered i/o. 2. check only on row = build_row + build_side, and col = build_col + build_side coordinates. its very simple. More formal: let build structure: struct build{ int priority; int len; int row; int col; } build d[M]; int L, A; // L - length of square city, A - length of building Park . so need to check only (think about it!!!) row = d[i].row + d[i].len ; col = d[j].col + d[j].len ; i=0..M-1,j=0..M-1 coordinates. Good Luck!!! Don't forget also, for row + A-1 <= L and col + A - 1 <= L | | yet another hint WA12 | c_pp | 1074. Очень короткая задача | 2 янв 2017 21:28 | 1 | in more languages "3." or "0.E+6" numbers are legal. but for there are not, i.e. input: 3. 1 0.E6 3 # output: Not a floating point number Not a floating point number Edited by author 02.01.2017 21:42 | | Runtime error test 9 | NumbMoon | 1795. Мужья в магазине | 2 янв 2017 21:14 | 1 | Could someone give me some tests for this one? | | If you have WA 3 | Moonstone [Samara SAU] | 1795. Мужья в магазине | 2 янв 2017 21:09 | 5 | Try this test case: 1 1 of vodka 1 2 of vodka Answer = 1 Thank you! I was being mad about this WA during the contest. :) Why answer is 1? He wants more than is in the shop, so he calls his wife and asks her. This means that the answer is 2. Or I misunderstood? Because he is letting our hero go in front of him, which is the main objective. | | Can't figure out the "swap" part | NumbMoon | 1795. Мужья в магазине | 2 янв 2017 18:20 | 1 | Could anyone, please, explain it to me? I can't understand how to program it. I'm filling the "amount of name" for the storage in the shop and for the queue, then, for each human from the queue, I check, firstly, whether the shop has the product the customer needs to buy, and then, if the shop has it, I compare the amounts. But I have a problem in understanding the part where the shop doesn't have enough of the product and the customers switch places. Could anyone explain it to me? | | What is Test 2? | Daniel Paleyev SESC USU | 2035. Очередной пробный тур | 1 янв 2017 23:46 | 2 | | | Wrong answer... help me.. plz | Vonni | 1224. Спираль | 1 янв 2017 23:45 | 3 | #include <stdio.h> int main() { int N, M; scanf("%d%d",&N,&M); long int res; if (N <= M) res = 2 * (N - 1); else res= 2 * (M - 1)+1; printf("\n%d",res); return 0; } Can't solve this promlem myself. I run your code online on some tests, it seemed ok. Check, maybe you go out of range in res? (know nothing about C) | | why this is not accepted? | Md.Toufiqul Islam | 1000. A+B Problem | 31 дек 2016 14:43 | 4 | where is the problem #include<stdio.h> int main(void) { int a,b,sum; printf("a:"); scanf("%d",a); printf("b:"); scanf("%d",&b); sum=a+b; printf("Sum=%d",sum); return 0; } Edited by author 03.12.2015 01:58 And. Did you run it locally? Try please. You should have crash here: scanf("%d",a); scanf("%d",a); scanf("%d",&a); | | can someone help me? | Alexandar | 1386. И снова лабиринт | 30 дек 2016 15:00 | 11 | I really can't solve this task? Alwaus got TLE on test 39 :-( Can someone give me hint or ... As for me, simpliest way is to use assembler instructions. There are some optimizations like this: Bad code: for (x = 0; x < W; x++) for (y = 0; y < H; y++) A[y][x] = 1; This code works much faster than previous one: for (y = 0; y < H; y++) for (x = 0; x < W; x++) A[y][x] = 1; Still nothing :-( This problem is driving me crazy!!!! There is one optimization, that speeds up simple solution in about 5 times. So, keep on solving. Please send me some hint!! a:array[1..4,1..10000] of word; for k:=1 to 4 do for i:=1 to n*m do begin if i mod m=0 then readln(p1,p2) else read(p1,p2); a[k,i]:=(p1-1)*m+p2; end; this be fast i think it more faster :) a:array[1..4,101..10100] of word; for k:=1 to 4 do for i:=1 to n*m do begin if i mod m=0 then readln(p1,p2) else read(p1,p2); a[k,i]:=p1*m+p2; end; Вообще если про скорость проверка if i mod m=0 все тормозит k++; if (k==m){ readln(p1,p2); k=0; } else read(p1,p2); надо так и еще очень ускоряет (покрайней мере у меня разные там битовые сдвиги) I wrote a starightforward O(N*M*S) solution without any optimizations and got AC. Had TLE in java. Rewritten in C -> AC. | | Hint test 9 | Cebotari Vladislav | 1562. Ананас | 30 дек 2016 14:59 | 1 | I had a program like that: while (x <= b/2) { .... x += dx } but it will fail test 1 1 100 (the last piece won't show). Changed to while (x <= b/2 + 0.000001) { .... x += dx } Got AC! | | Faster Ideas | georgi_georgiev | 1071. Никифор 2 | 30 дек 2016 00:39 | 4 | I Solved this problem, by transforming x and y into every system and search for the longest common substring. But I am interested in another Ideas, better than mine, except brute force. it isn't necessary to search LCS (O(|x|*|y|)), you can check only what y is subsequence of x, so it will be O(|x|+|y|) Edited by author 30.08.2009 16:00 Verification of this fact is O(log(max(x,y))) base = 2..1000 bruteforce, base > 1000 think a little :)) | | Орфография | Alex Mullabaev`` | 2059. Не общие подпалиндромы | 29 дек 2016 22:41 | 1 | Нас просят найти количество непустНых палиндромов. | | test case #1 | Fatima Jahara | 1510. Порядок | 29 дек 2016 04:14 | 2 | Test case #1 is usually from the sample. Input 5 3 3 2 2 3 Output 3 | | Problems with input and output with samples on Guide Session for Haskell | Jose_Silva | | 28 дек 2016 18:59 | 1 | Okay! Haskellers understand here! If you need use getContents for input you have two options for local executions on linux or unix environments: 1) Create file with inputs and execute on command: cat input.txt | ./main(haskell program) 2) On terminal execute the program, copy and past your entry for program and execute <CTRL>+D for EOF. That form the program execute and complete your operations. I'm let that here only for informations for others new for Haskell. Thank you, Hygens ################################################################################### Hi, haskellers on duty! I'm attempting test the script haskell on mine environment for "1001 - Reverse Root" problem using the same code exposed on Guide session for Haskell but here freeze without response on display. My environment is based on Linux Mint 16.04 with GHC 7.10.3. Exists any detail that I have passed or I have update that script for that version of Haskell?! Not occure any error on environment simple that freeze without response for long time and I break the execution. Some can help on that or had same proglem for ubuntu or mint?! Thank you, Hygens Edited by author 28.12.2016 18:59 Edited by author 28.12.2016 19:30 | | question to every one | Giorgi Javakhadze [Tsereteli SU] | 1060. Перевертыш | 28 дек 2016 03:21 | 7 | what is the answer for the following test bbbb wwwb wbwb wbbb my AC code shows that answer is 7, is that right? My AC program show answer 5 coordinates: 1:1, 1:2, 2:2, 2:3, 1:4, board becomes all black Edited by author 07.06.2011 00:10 yes that's what i'm talking about, my code fails on that test, but i got AC. i think it need to add test That to admins ;) What algo you're used? Your different submissions takes significand different time. Looks like random-based algo ) Edited by author 07.06.2011 00:26 i used recursion, those ones which execution time was higher had just deeper recursion My non-Accepted program gives 5. I have WA#11 | | There exists O(2^8 * 8 ) solution !!!! | c_pp | 1060. Перевертыш | 27 дек 2016 22:40 | 1 | needn't all 2^16 search, divide it two part each 8 bit. | | WA #14 | zaitsevmishka | 1200. Рога и копыта | 27 дек 2016 21:04 | 1 | WA #14 zaitsevmishka 27 дек 2016 21:04 Can you please share some tests? Answer was correct on every test from forum, still can't pass test 14 + implemented all the hints, including rounding with 0.5000000001 and searching near the optimal values :( Thanks in advance! Edited by author 28.12.2016 02:12 | | Test #12? | superlifter | 1074. Очень короткая задача | 27 дек 2016 19:45 | 8 | my program calculate: Input: ====================================== String str = "10.23\n" + "0\n" + ".04\n" + "1\n" + "-0.051e0\n" + "1\n" + "1.1e30\n" + "10\n" + "-1.1E-30\n" + "1\n" + "2468097632.1358642324268913e-2\n" + "20\n" + "e23\n" + "3\n" + "1 e3\n" + "1\n" + "-7293874219874982174982174987321e-18446744073709551616\n" + "10\n" + "#1234\n" + "3\n" + " 12.0\n" + "3\n" + "2E-1\n" + "3\n" + "-\n" + "2\n" + ".e1\n" + "2\n" + "#"; ====================================== Output: ====================================== 10 0.0 0.0 1100000000000000000000000000000.0000000000 0.0 24680976.32135864232426891300 Not a floating point number Not a floating point number 0.0000000000 Not a floating point number Not a floating point number 0.200 Not a floating point number Not a floating point number ====================================== It's correct. why wrong test-12? try also -7293874219874982174982174987321E-18446744073709551616 10 -7293874219874982174982174987321E-4294967296 10 -7293874219874982174982174987321E-65536 10 -7293874219874982174982174987321E-256 10 9126492316491641269352615215701236589213658621356281376589216562319562396592381659862195621281E-190 100 1234E-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 2 # (note that last two - is long strings. That only displayed in this forum as several lines Edited by author 27.05.2011 21:51 Input: ============================= String str = "-7293874219874982174982174987321E-18446744073709551616\n" + "10\n" + "-7293874219874982174982174987321E-4294967296\n" + "10\n" + "-7293874219874982174982174987321E-65536\n" + "10\n" + "-7293874219874982174982174987321E-256\n" + "10\n" + "9126492316491641269352615215701236589213658621356281376589216562319562396592381659862195621281E-190\n" + "100\n" + "1234E-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002\n" + "2\n" + "#"; ================================== Output: ================================== 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009126 12.34 ================================== It's correct. Edited by author 30.05.2011 14:22 There are some more examples? try 9E-9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 100 -1E-1 5 send to me your solution at aterlux @ mail . ru if you want, I'll take a look Edited by author 30.05.2011 17:20 Input: ============================= String str = "9E-9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n" + "100\n" + "-1E-1\n" + "5\n" + "#"; ================================== Output: ================================== 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0.10000 ================================== It's correct. I have resolved! It's my bug. My program has not processed this case: ====== +.0 0 ====== This example has this answer: ====== 0 ====== But my program has this answer: ====== Not a floating point number ====== I passed all the above cases including the +.0 0 but still WA. | | Hint for WA#3 | Cebotari Vladislav | 1038. Проверка орфографии | 27 дек 2016 18:30 | 1 | I had WA#3 because of how I was reading the input in C: while (gets(buff) != NULL) { int i = 0; while (buff[i] != '\0') { // process char by char i++; } } Changed to: while ((c = getchar()) != EOF) { // process char by char } And it works AC!!! |
|
|