| Show all threads Hide all threads Show all messages Hide all messages |
| # Test 2 ... | Esteban Suazo | 1197. Lonesome Knight | 21 Oct 2020 02:00 | 2 |
What is wrong with my code? :( #include <stdio.h> #include <stdlib.h> int main (){ int N; scanf ("%d",&N); for (int i = 0 ; i < N ; i++){ char x; int y; getchar(); scanf ("%c %d",&x,&y); int movimientos = 0;
if (y + 2 <= 8) if (x - 1 >= 97){ movimientos++; }
if (y+2 <=8) if (x + 1<=104){ movimientos++; } if (y-2 >= 1) if (x-1 >97){ movimientos++; } if (y-2 >= 1) if (x + 1 <= 104){ movimientos++; }
if (x+2 <= 104) if (y - 1 >= 1){ movimientos++; } if (x+2 <= 104) if (y+1 <= 8){ movimientos++; } if (x-2 >= 97) if (y+1 <= 8){ movimientos++; } if (x-2 >= 97) if (y-1 >= 1){ movimientos++; } printf ("\n %d", movimientos); printf ("\n"); }
return 0; } Edited by author 21.10.2020 01:36 Edited by author 21.10.2020 01:37 just had to consider from 'a' 'h' and '1' '8' |
| WA 21 | Ilya Konik | 1773. Metro to Every Home | 18 Oct 2020 21:58 | 1 |
WA 21 Ilya Konik 18 Oct 2020 21:58 Can anybody give me ideas about 21 test, please? Edited by author 18.10.2020 22:11 Edited by author 19.10.2020 03:42 |
| No subject | D4nick | 1295. Crazy Notions | 17 Oct 2020 04:13 | 1 |
1^n+2^n+3^n+4^n will never give you summ [1..9]*(2*5)^3, and there will not be three zeros as well, thus this programm will work: vector <vector <int>> st(3); st[0].push_back(2); st[1].push_back(3); st[2].push_back(4); for (int i = 0; i <= 2; i++) { int osn = i + 2; for (;;) { int newst = (osn * *--st[i].end()) % 100; if (!count(st[i].begin(), st[i].end(), newst)) st[i].push_back(newst); else break; } } int n; cin >> n; n--; int sum = 1 + st[0][n < 21 ? n : n % 20 ] + st[1][n % 20] + st[2][n % 10]; if (sum % 100 == 0) cout << 2; else if (sum % 10 == 0) cout << 1; else cout << 0; Edited by author 17.10.2020 04:13 |
| Think about these results...Observe carefully and u will find solution easily...:) I hope this will help u | ইলহাম আল মুসাব্বির | 1295. Crazy Notions | 16 Oct 2020 03:05 | 2 |
For n= 1 sum is 10 For n= 2 sum is 30 For n= 3 sum is 100 For n= 4 sum is 354 For n= 5 sum is 1300 For n= 6 sum is 4890 For n= 7 sum is 18700 For n= 8 sum is 72354 For n= 9 sum is 282340 For n= 10 sum is 1108650 For n= 11 sum is 4373500 For n= 12 sum is 17312754 For n= 13 sum is 68711380 For n= 14 sum is 273234810 For n= 15 sum is 1088123500 For n= 16 sum is 4338079554 For n= 17 sum is 17309140420 For n= 18 sum is 69107159370 For n= 19 sum is 276040692700 For n= 20 sum is 1102999460754 For n= 21 sum is 4408508961460 For n= 22 sum is 17623571298330 For n= 23 sum is 70462895745100 For n= 24 sum is 281757423024354 For n= 25 sum is 1126747229006500 For n= 26 sum is 4506141560307690 For n= 27 sum is 18022024241184700 For n= 28 sum is 72080471098818354 For n= 29 sum is 288299007065947540 For n= 30 sum is 1153127396812683450 For n= 31 sum is 4612303693971155500 For n= 32 sum is 18448597098193370754 For n= 33 sum is 73792535363994696580 For n= 34 sum is 295164582378232361610 For n= 35 sum is 1180641652296870041500 For n= 36 sum is 4722516577573661689554 For n= 37 sum is 18889916215521910805620 For n= 38 sum is 75559214577906874318170 For n= 39 sum is 302235507459360068466700 For n= 40 sum is 1208937977281187743262754 For n= 41 sum is 4835739751457092892866660 For n= 42 sum is 19342922532827596354169130 For n= 43 sum is 77371580712312457811295100 For n= 44 sum is 309485994592264844522058354 For n= 45 sum is 1237942993598122010104911700 For n= 46 sum is 4951769020079711120841770490 For n= 47 sum is 19807067217380584093377630700 For n= 48 sum is 79228242280707695941030524354 For n= 49 sum is 316912889356387143941658812740 For n= 50 sum is 1267651318126218219249198818250 For n= 51 sum is 5070604554606882933344392817500 For n= 52 sum is 20282416064733564154220177588754 For n= 53 sum is 81129657797852358383008156681780 For n= 54 sum is 324518611808163747837614220448410 For n= 55 sum is 1298074389082917952281600172439500 For n= 56 sum is 5192297381882460727948627580659554 For n= 57 sum is 20769189004182209740318785033270820 For n= 58 sum is 83076754446685939590963152340836970 For n= 59 sum is 332307013076615060541147022138320700 For n= 60 sum is 1329228038176074149272932079181624754 For n= 61 sum is 5316912110313138319569681793218371860 For n= 62 sum is 21267648314079078448018430611562799930 For n= 63 sum is 85070592874795889305904518780746525100 For n= 64 sum is 340282370354622283774333836163326852354 For n= 65 sum is 1361129477984805314767929371848039216900 For n= 66 sum is 5444517901638169798120393057123771393290 For n= 67 sum is 21778071575649524809701385913984767356700 For n= 68 sum is 87112286209888636090612558664997791190354 For n= 69 sum is 348449144561426154918166427592346682877940 For n= 70 sum is 1393796577411319451340404584976811991513050 For n= 71 sum is 5575186307142122300366015555350241157359500 For n= 72 sum is 22300745221059022686479615050971379025966754 For n= 73 sum is 89202980861707691200969841059079628938666980 For n= 74 sum is 356811923379245566169042951534866593549495210 For n= 75 sum is 1427247693314226668771681457501042086163317500 For n= 76 sum is 5708990772648639887373292563020758437710989554 For n= 77 sum is 22835963088769759186352946008996529944340536020 For n= 78 sum is 91343852349604635655991262422454060186498715770 For n= 79 sum is 365375409381995339355703787080674965630698254700 For n= 80 sum is 1461501637478711747618031964958185844491490546754 For n= 81 sum is 5846006549767038161057779518665020938501229477060 For n= 82 sum is 23384026198624726155988075469008555664869069190730 For n= 83 sum is 93536104793168625159223178894782916850585429435100 For n= 84 sum is 374144419168683662242705356306784306892702573406354 For n= 85 sum is 1496577676662762133788259366752908259875959655922100 For n= 86 sum is 5986310706615130989605351330274572364087420301176090 For n= 87 sum is 23945242826352771321778346988258359885436693418362700 For n= 88 sum is 95780971305087827377184213109256155739680344676816354 For n= 89 sum is 383123885219381535778949328215177781373867160442143140 For n= 90 sum is 1532495540874616821926434740814140620383596124422767850 For n= 91 sum is 6129982163489739324137651248354791005484147220552781500 For n= 92 sum is 24519928653932773405846341851189729672356637600594504754 For n= 93 sum is 98079714615652541951272577983022375797828217657124652180 For n= 94 sum is 392318858462374512788751943676783394830800914591931502010 For n= 95 sum is 1569275433848791086105992669961022294870233874656410675500 For n= 96 sum is 6277101735393043449276925365645369407379158316288468679554 For n= 97 sum is 25108406941565811111666565520064546475725566055735896601220 For n= 98 sum is 100433627766244156390342854252865848766557591269876739954570 For n= 99 sum is 401734511064919361392401193529603296307253403570680596268700 For n= 100 sum is 1606938044259505653062694103673466714252196844456991646028754 The output will be 0, 1 or 2... See the divisibility of n by some numbers (like 4) , their remainders and make a relation with the outputs... Have a Happy Coding... ^_^ |
| Interesting problem, I like it, thanks | D4nick | 1982. Electrification Plan | 16 Oct 2020 02:58 | 1 |
|
| This is not an MST problem. | grinrag | 1982. Electrification Plan | 16 Oct 2020 02:49 | 3 |
This is not an MST problem, because finally, we can have a graph with several connected components (not a tree). For example, if a city has a power station and the price to build a line to another city is too high we can just isolate this city. Such test: 4 2 1 4 0 1 1 7 1 0 5 2 1 5 0 2 7 2 2 0 The answer is 2. We build line 1 <-> 2, 1 <-> 3. The total price is 2. It's not necessary to build any line to city 4. I don't know, maybe there are no tests for such cases. Edited by author 09.10.2019 16:52 Yeah, not MST, it's MSF :) :) :) |
| If any WA. All tests you may need. | D4nick | 1123. Salary | 14 Oct 2020 21:56 | 1 |
12341321 12344321 12991321 12999921 12341991 12344321 12343991 12344321 12344991 12355321 1234554991 1234664321 1234559991 1234664321 1134559921 1134664311 1134998821 1135005311 8999999999 9000000009 89999 90009 1250025 1250521 1999 2002 100003 101101 11111 11111 1000003 1001001 1999992 2000002 1009002 1010101 18 22 36313404080 36313431363 3373687313428241827948801150507677526 3373687313428241828281428243137863733 669262074855963079771197586206281259112 669262074855963079777970369558470262966 242167700017836474388100 242167700018810007761242 16252383 16255261 469342775745586144105609869 469342775745595547577243964 37461293193018561603953493340 37461293193018581039139216473 9194184285169534216966507128749 9194184285169534359615824814919 21 22 1330454685235862 1330454774540331 78336742687917227491028 78336742687978624763387 47923802054017335212073765802860114 47923802054017335253371045020832974 505752 506605 940 949 428540910018912794058956977 428540910018919810019045824 9770330728908946347636591906356869449214 9770330728908946347667436498098270330779 7068416097840258049887921681085 7068416097840258520487906148607 517805724457730620 517805725527508715 506833497 506838605 5820 5885 484243646784563247619038458645194136 484243646784563247742365487646342484 91413688117232096060 91413688122188631419 771886477139587251334596 771886477139931774688177 8304292305552149553379655920949280409378 8304292305552149553443559412555032924038 9628134090110628 9628134114318269 2445193927845273449357413443 2445193927845335487293915442 519 525 6885428526826048829 6885428527258245886 72924386042452563577194755578 72924386042452625424068342927 123012 123321 123131 123321 36408 36463 123 131 |
| AC at last!!! | CHIDEMYAN SERGEY | 1306. Sequence Median | 14 Oct 2020 17:20 | 8 |
I get AC using priority_queue<unsigned int> At first I push n/2+1 numbers then I read next number,push it to queue,pop biggest element until I have elements If n odd I use 1 top elem for answer else I use 2 top elements for answer such way: if (top1+top2) mod 2=0 I output top1/2+top2/2+top1 mod 2 and then print ".0" else I output top1/2+top2/2 and then print ".5" I hope it'll help somebody. P.S thank to authors of this problem.I like this problem very much!
Edited by author 07.02.2008 01:49 Thanks Dengin Roman 21 Mar 2012 15:24 CHIDEMYAN SERGEY, thanks a lot! You helped me very much. Finally, I passed it! Edited by author 21.03.2012 15:27 MLE husniddin351 24 Jan 2018 22:55 It's getting MLE7 . I did as you said! Edited by author 24.01.2018 22:56 Edited by author 24.01.2018 22:56 Re: MLE bstu_student 27 Aug 2018 22:20 new compilers "eat" more memory oh, really? I am wondering how is it possible at all to store n/2 elements in the heap (for n=250k we use 32 bits times 125000 / 2^20 and thus we get approximately 3.815MB) and not to get MLE there. Re: MLE lostbrain 14 Oct 2020 17:20 Bits 32*125000 = 4e+6 bits We know that 1Mb = 8e+6 bits So we end up getting 0.5 MB if storing n/2 elements. And exactly 1MB for storing n elements. Edited by author 14.10.2020 17:20 Edited by author 14.10.2020 17:20 |
| WA at Test# 8 | sanket bhandare | 1786. Sandro's Biography | 14 Oct 2020 11:28 | 1 |
Please help. what is test case 8. so that i can verify my answers. |
| test #5 | Sperow | 1910. Titan Ruins: Hidden Entrance | 14 Oct 2020 01:59 | 1 |
I can't find a problem Please, help my code (C++): #include <iostream> #include <string> using namespace std; int main() { int a, b, c, sum, sr, i, n; cin >> n; cin >> a >> b >> c; sum = 0; if (n == 3) { sum = a + b + c; sr = 2; } else { for (i = 3; i < n; i++) { if ((a + b + c) > sum) { sum = a + b + c; sr = i - 1; } a = b; b = c; cin >> c; } } cout << sum<< " "<<sr;
return 0; } |
| To admins | Levon Oganesyan | 1971. Graphics Settings | 13 Oct 2020 23:29 | 2 |
In Russian version there is a mistake in the constraints of h. Must be 200, not 260. |
| on drugs | MARAZ MIA | 1083. Factorials!!! | 13 Oct 2020 18:41 | 1 |
for n=2,k=3 ans=2*(2-3)*(2-6)*(2-9)*..... The author must include the condition that n>=k.. |
| O(n^3) accepted fairly easy | Tabledott | 1052. Rabbit Hunt | 13 Oct 2020 05:00 | 3 |
I coded O(n^3) that was accepted fairly easy... But I know there is O(n^2) algo but I don't know how to implement it.. Any Ideas? Yaa i have the idea of O(n^2).First you can can calculate the slopes of all lines in O(n^2).Create a class which contains the 2 points and the slope of the line joining two points.Note that there will be n(n+1)/2 nodes and define operator == as: slopes are equal and one point must be common to both the lines. I have tl with long double and wa with double on that O(n^2) solution Edited by author 13.10.2020 05:01 |
| Что курил, автор, лол? :DDD | D4nick | 1283. Dwarf | 13 Oct 2020 01:25 | 1 |
|
| VERY SIMPLE SOLUTION. | c_pp | 1102. Strange Dialog | 13 Oct 2020 00:29 | 3 |
There only 10 situations!!!!! //1. in //2. input //3. inputon //4. inputone //5. out //6. output //7. outputon //8. outputone //9. puton //10. one Check their in inverse order. bool check(char const* s){ while(*s != '\n'){ if (s == "one") s += 3; // there s == "one" only pseudocode, you may check // as memcmp(s, "one",3) == 0 else // ...... //............. // 10 times else else if (s == "in") s +=2; else return false; } return true; } thnx a lot c_pp atleast i learn something |
| Funny question | guilty spark | 1640. Circle of Winter | 12 Oct 2020 00:08 | 1 |
what a question haha. just read the question carefully |
| Optimize my recursion solution | Hadji | 1152. False Mirrors | 9 Oct 2020 17:36 | 1 |
I got tl5 using recursion solution, and i dont know how to optimize it. Please give me some hints how to solve it better |
| How can this be solved? Can anyone help?(+) | asif | 1227. Rally Championship | 8 Oct 2020 20:56 | 11 |
Is there any polynomial time solution? I can WAZZAP 14 Nov 2002 16:52 > Is there any polynomial time solution? yes. - if there is a cycle the answer is always "yes" - if there is a knot (ex. 2 2 edges), the answer is also "yes" - if graph is multigraph, yes too if all above is false just find the longest path in a tree and play with it's value in comparsion with route length > > Is there any polynomial time solution? > yes. > > - if there is a cycle the answer is always "yes" > - if there is a knot (ex. 2 2 edges), the answer is also "yes" > - if graph is multigraph, yes too "multigraph" : what is it? I got WA so many times,any trick? > > if all above is false just find the longest path in a tree and > play with it's value in comparsion with route length > > Thanks. I did not read the question well enough and thought that the race must start and end on vertices. How stupid of me! That is why I asked that stupid polynomial question. > > > Is there any polynomial time solution? > > yes. > > > > - if there is a cycle the answer is always "yes" > > - if there is a knot (ex. 2 2 edges), the answer is also "yes" > > - if graph is multigraph, yes too > "multigraph" : what is it? I got WA so many times,any trick? > > > > if all above is false just find the longest path in a tree and > > play with it's value in comparsion with route length > > > > Edited by author 23.07.2008 05:54 > "multigraph" : what is it? I got WA so many times,any trick? multigraph can have more than one edge connecting 2 vertices. Those edges can have different length. So, if there are two or more edges, connecting 2 vertices, this is just another cycle. This task is quite tricky and not well-right from the point of diskrete maths. For example, non-oriented graph can not have knots (by the difinition), but in this problem this is one of the "triks". but how to judge whether there's a cycle? do DFs and if there a return edge than u have a circle or do n Dijkstra's and if u can get back to the point than u have a circle I can't understand why if there is cycle, the answer is always yes -> what about this test: 3 3 1000 1 2 3 2 3 3 1 3 3 Edited by author 21.07.2009 12:43 Why YES? Petr Huggy (Pskov) 21 Nov 2010 12:32 Because there is a cycle with length 9, and we can ride this path unlimited number of times. "The race may start and finish anyplace on the road" |
| Hint | frochbg | 1034. Queens in Peaceful Positions | 8 Oct 2020 13:15 | 2 |
Hint frochbg 3 Oct 2020 13:37 I have been trying to solve this problem for several days, but suddenly I ran out of ideas. Could you give me some hints on the task? I have tried brute force and some pruning, but it got TLE. I would be really happy! :) I've got AC! The main observation is that no two queens can be in the same row or column. Thus, we make an array perm[i], which stands for queen in the ith row and perm[i]th column. The problem is to find the number of permutations, which differs from the initial by 3 elements and check for each possibility whether we have conflicts on the diagonals. perm[i] is the initial permutation. I hope this hint was helpful! |
| help test19 | marlen200186 | 1208. Legendary Teams Contest | 8 Oct 2020 00:26 | 1 |
|