Common Board| Show all threads Hide all threads Show all messages Hide all messages | | Need Help TEAST CASE5 | Dewesh Deo Singh | 1119. Metro | 22 Jan 2018 12:24 | 2 | I am getting WA 5 Can anyone provide me the test case 5.. or hint to test case 5.. same with u LOL i WA test 5 :"( | | ПОМОГИТЕ НАйТИ ОШИБКУ | Vsevolod | 1607. Taxi | 20 Jan 2018 21:48 | 1 | var a,b,c,d,cen,k:integer; begin read(a,b,c,d); while k<>1 do begin if (a+b>c) then begin k:=1;cen:=c;end else a:=a+b; if(c-d<a)then begin k:=1;cen:=a;end else c:=c-d;end; writeln(cen); end. | | if you have wa#2 | Imosk72 | 1836. Babel Fish | 20 Jan 2018 08:25 | 1 | try to change your variables to double, and don't use int. | | How about case M>N(+)? | SPIRiT | 1580. Dean's Debts | 20 Jan 2018 04:29 | 5 | I think it's clear for the system of linear equations, that if M<N, than it's impossible. If M=N then it may be possible (and I know how to check). How about case M>N? We need to select N pairs that get an unambiguous solution? You have to keep only the lineary independet ones, I think. What I did is I kept only the first 5 ones, which contain certain number (so the matrix in the end was at most 5000 rows long, containing at least 5 rows, containing a digit at each position) and it passed system test (otherwise the solution was right, but too slow) Just find at least one odd loop in each connected component Just find at least one odd loop in each connected component hmm i make this but i get TLE( test 12)... (with a BFS) any ideea why? What I did is I kept only the first 5 ones, which contain certain number Strange. It will not work for this test (A_i can be arbitrary). 43 43 2 3 0 1 2 0 1 3 0 1 4 0 1 5 0 1 6 0 1 7 0 2 8 0 2 9 0 2 10 0 2 11 0 2 12 0 2 13 0 3 14 0 3 15 0 3 16 0 3 17 0 3 18 0 3 19 0 4 20 0 4 21 0 4 22 0 4 23 0 4 24 0 4 25 0 5 26 0 5 27 0 5 28 0 5 29 0 5 30 0 5 31 0 6 32 0 6 33 0 6 34 0 6 35 0 6 36 0 6 37 0 7 38 0 7 39 0 7 40 0 7 41 0 7 42 0 7 43 0 Edited by author 20.01.2018 04:30 | | first test is sample? WA1 | kaifonaft | 1532. Lost in Translation | 18 Jan 2018 21:23 | 2 | Yes. First test is sample. I check it!) //WA 2: )) Console.WriteLine(@"5 moina morna palpa papa pella"); Just wrong sort in my program. | | Is "1513.Lemon Tale" the same problem? | Mahilewets | 2018. The Debut Album | 18 Jan 2018 11:26 | 7 | Yes, Lemon Tale is just the same problem. Even easier problem. Problem rating lies heavily : 106 vs 400. well it is true that this problem is harder in concept but that problem i think is just harder to implement in competition unless you use javabiginteger, but in c++ u must implement addition and diference with biginteger, and this problem is just done in about 10 lines of straight code There exists four or five lines python solution using only python lists 1513 has tighter limits though For this problem, you can implement a dp in O(n * (a + b)) but in Lemon Tale you can't There are another similar problems, where rank lies. Say, 1285 is formally harder, then 1075. But if one have already solved 1075, then, probably, one may need to change just single dimensionality constant from 3 to 8 to get solution of 1285. Rate of ACs should be slightly less for harder, but latter problem, for sure. Another factor is the optimistic one: people are getting smarter and smarter on an average. New problems are solved by less efforts. The technological singularity is coming! Edited by author 18.01.2018 11:30 | | Great Problem! :-) | Ostap Korkuna (Lviv NU) | 1324. Extra Spaces | 18 Jan 2018 07:16 | 5 | I'd like to thank authors for this problem - it became one of my favorite on Timus! Thanks again for very interesting problem! :-) what is that can you tell me what problem it is It's the one that is in the caption of this message :-) It's 1324. Yeah.. But limits could be higher... What about 10^20? :) Or even 10^33. 64-bit integer is still enough (for answer, not for input, but we can just ignore too long input). Or even 10^{10^4}. Works for naive long multiplication. Or even 10^{10^5}. Works in 0.3 in python (only 8 lines!). Or even 10^{10^6}. Hello, FFT! For problem can be solved in T(n), where n = length of input, T(n) is time of multiplication. | | Floyd-Steinberg dithering works!!! | B@R5uk | 1363. Halftones | 17 Jan 2018 15:53 | 2 | Unfortunately entirely deterministic version of this algorithm fails on Test #10. So I'm very curious about this Test #10. Because I've done a lot of testing in MATLAB of varoius modification of Floyd-Steinberg dithering algo, including zig-zag proseccing and edge attending. In all cases constraint in statement can be hardened from 20 to 10 and even less. On normal images error is about 6-8. I guess Test #10 some kind of periodic image, that has bad compatibility with that unnatural restriction put in the problem. I mean it square form and discontinuous nature. I think dithering yield much more better image than that which can be produced by uniform minimization of constrain function. I solve this issue whit Test #10 by adding a little bit of randomness in my dithering algo. I mean in place of this threashold function: int quantize(int value) { if (127 < value) { return 255; } return 0; } I'm using this function: int quantize(int value, int randomness) { if (127 - randomness + rng.nextInt(2 * randomness + 1) < value) { return 255; } return 0; } This provides me with magical parameter "randomness" varying which and playing tambourine I got my AC. 8-] I think I should add constraints checking and reprocessing in case the check was a fail, but I'm too lazy, I guess in case of possible future rejudging everything will be fine. :) I express my sincerest thanks to authors of this beautiful problem. It has bugged me a lot in era of matrix printers how can they do this funny dotted images. Finally I have my answer and I can even do it myself!!! Edited by author 17.01.2018 02:43 There is very good article about others dithering algorithms: http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/ It even mention static dithering. But I want to disagree over the way they implemented error partitioning to distribute it among neighbouring pixels: they are dividing the error, then multiplying it and then adding to neighbours. Using integer arithmetics this leads to relatively big errors producing that can be reduced by first multiplying and only then dividing. But this approach has the same error source, namely discading remainder after division, it's just not multiplied further. Taking into account constrants put in the problem it will be much better to calculate all the remainders and put them in one or more pixels. Just compare the following: { error1 = 1 * (error / 16); error3 = 3 * (error / 16); error5 = 5 * (error / 16); error7 = 7 * (error / 16); } { error1 = (1 * error) / 16; error3 = (3 * error) / 16; error5 = (5 * error) / 16; error7 = (7 * error) / 16; } { error1 = (1 * error) / 16; error -= error1; error3 = (3 * error) / 15; error -= error3; error5 = (5 * error) / 12; error -= error5; error7 = (7 * error) / 7; } Edited by author 17.01.2018 15:59 | | ответ на С++ | Anastasiya | 1787. Turn for MEGA | 17 Jan 2018 14:42 | 2 | #include <iostream> using namespace std;
int main() { int k, n, res=0; cin >> k >> n; int *mas = new int[n];
for (int i=0; i!=n; i++) { cin >> mas[i];
if (mas[i] > k) { res = res + (mas[i] - k); } else { if (res!=0 ) { if ((k - mas[i]) > res) { res = 0; } else { res = res - (k - mas[i]); } } }
} cout << res; return 0; } This is the mean. Edited by author 17.01.2018 14:44 | | How fast can you solve it for the case d <= n? | ARK (***AESC_USU***) | 1827. Indigenous Wars | 16 Jan 2018 07:51 | 1 | | | wrong 8 why?? | Nursat Yermakhanbet | 1567. SMS-spam | 16 Jan 2018 06:54 | 1 | ll n, m, ans; st s; int main(){ while(cin >> s){ for(int i = 0;i < s.sz;++i){ if(s[i] == 'b' || s[i] == 'e' || s[i] == 'h' || s[i] == 'k' || s[i] == 'n' || s[i] == 'q' || s[i] == 't' || s[i] == 'w' || s[i] == 'z' || s[i] ==',') ans+=2; if(s[i] == 'a' || s[i] == 'd' || s[i] == 'g' || s[i] == 'j' || s[i] == 'm' || s[i] == 'p' || s[i] == 's' || s[i] =='v'|| s[i] == 'y' || s[i] == '.') ans+=1; if(s[i] == 'c' || s[i] == 'f' || s[i] == 'i' || s[i] == 'l' || s[i] == 'o' || s[i] == 'r' || s[i] == 'u' || s[i] == 'x'|| s[i] == '!') ans+=3; } ans++; } cout << ans - 1; }
| | wa test #3 | acmprep | 1211. Collective Guarantee | 16 Jan 2018 02:11 | 5 | Why did you got wa on test 3 ? I'm having the same problem... :( try this test: 1 16 2 3 4 5 1 2 3 4 5 2 2 2 2 2 2 0 answer, it is clear, NO, but this test helped me when I had WA#3 I had WA#3, too. That test helped me. 1 5 0 0 0 0 0 It's NO, of course! ) Edited by author 16.03.2006 16:39 Edited by author 16.03.2006 16:40 Or maybe it is 1 5 0 3 4 5 3 Answer: NO >>Or maybe it is >> >>1 >>5 >>0 3 4 5 3 >> >>Answer: NO ASK, thank you. If there is a loop in graph that can be entered by branch from nodes earlier in list then loop nodes than some naive algorithms can fail on this test. By the way, why not to add the tag GRAPH THEORY to this problem? It not that deep though. | | Test 11 | mouse_wireless2 | 1621. Definite Integral | 15 Jan 2018 20:09 | 1 | Test 11 mouse_wireless2 15 Jan 2018 20:09 If you're struggling with test 11, the test is: 1 0 1000000 -2000 1 Exact (up to 1e-14) answer is 0.00628318530714 If your solution passes this, it will most likely pass all tests :) | | Help me please! | Roa28 | 1785. Lost in Localization | 15 Jan 2018 18:24 | 4 | Только начал изучать С++. Решаю задачки для новичков. Что не так здесь? #include <iostream> #include <conio.h> using namespace std; int main() { int A; cout << "How many?"; cin >> A; if(A < 1 || A > 2000) { cout << "wrong input!"; }else { if(A <= 4) cout << "few"; else if(A <= 9) cout << "several"; else if(A <= 19) cout << "pack"; else if(A <= 49) cout << "lots"; else if(A <= 99) cout << "horde"; else if(A <= 249) cout << "throng"; else if(A <= 499) cout << "swarm"; else if(A <= 999) cout << "zounds"; else cout << "legion";} return 0; } компилировал на Visual studio 2012 - все работает. почему тут не принимает? don`t write How many it is wrong : and not "||" you should "&&" it is true good luck #include <iostream> using namespace std; int main() { int a; cin >> a; if (a >= 1 and a <= 4){ cout << "few"; if (a >= 5 and a <= 9){ cout << "several"; if (a >= 10 and a <= 19){ cout << "pack"; if (a >= 20 and a <= 49){ cout << "lots"; if (a >= 50 and a <= 99){ cout << "horde"; if (a >= 100 and a <= 249){ cout << "throng"; if (a >= 250 and a <= 499){ cout << " swarm"; if (a >= 500 and a <= 999){ cout << " zounds"; if (a > 1000){ cout << " legion"; } } | | Please, say. Where I Wrong? (C#) | Serge | 1020. Rope | 15 Jan 2018 05:46 | 1 | Edited by author 15.01.2018 06:34 | | help with 52 pls | 🎧 Vadim Barinov \Frez_Fstilus/'` | 1509. Domino Recognition | 14 Jan 2018 02:11 | 2 | What may cause this judgement result? I think there is an error in your domino size cheking function or something similar. See your other topic for details. | | Sol with WA 46, 47, 48 | 🎧 Vadim Barinov \Frez_Fstilus/'` | 1509. Domino Recognition | 14 Jan 2018 02:08 | 2 | WA 46: 2 0 0 0 0.5 Ans: 0 2 WA 47: 2 0 0 0 99 Ans: 1 1 WA 48: 2 0 0 0 1 Ans: 0 2 1 1 > WA 46: > 2 > 0 0 > 0 0.5 > Ans: > 0 2 Your answer is incorrect. There is no dominoes which fit with your input. Maximum related L (for 0-2 domino) is 1/sqrt(2) that is outside of permissible range of [1, 100]. But thank you nonetheless!!! Your hint allowed me to get my AC 8-] | | WA 12 | Kostya | 1943. Space Rummy | 14 Jan 2018 01:24 | 2 | WA 12 Kostya 25 Dec 2017 11:54 Re: WA 12 ARK (***AESC_USU***) 14 Jan 2018 01:24 Increasing (maybe except n) sequence. I.e. something like 1 2 5 3 4, 1 2 3 4 5 6, 7 1 2 3 4 5 6. And answer is "YES". Actually, there are only 7 inputs with answer "NO". Edited by author 14.01.2018 01:28 | | This is soo000ooo funny problem! | B@R5uk | 1704. Demodulation | 13 Jan 2018 21:30 | 1 | You need to compute two scalar products, each for 0 bit and 1 bit. Then just compare it. That'a ALL!!! If you are afraid of amplitude being negative then abs() each product and compare them after. There is no need to fuss about anything: carriers and constant level orthogonal to each other and noise guaranteed to be small by problem statement. Well, if noise was too big betrayer would never be able to transmit his data. Even if every bit was transmitted with differen amplitude and different constant level this approach still would work. I just do not undestand why this problem is rated soooooo high?! | | Chess problem...TLE on test #10!! how to make it faster????? | michel mizrahi | 1298. Knight | 13 Jan 2018 01:57 | 9 | I really stuck with this, I don't know how to make my algorithm faster here is my code: #include <stdio.h> char board[10][10]; char letter[66],num[66]; int n,s=0,ncuad; int pos_f[8]={-1,-2,-2,-1, 1, 2, 2, 1}; int pos_c[8]={-2, 1,-1, 2, 2, 1,-1,-2}; init_board(){ int i,j; for(i=1;i<=n;i++) for(j=1;j<=n;j++) board[i][j]='0'; } search(int i,int f,int c){ int j=0; if(s==1) return 0; if(board[f][c]=='0'){ board[f][c]='1'; switch(f){ case 1: letter[i]='a';break; case 2: letter[i]='b';break; case 3: letter[i]='c';break; case 4: letter[i]='d';break; case 5: letter[i]='e';break; case 6: letter[i]='f';break; case 7: letter[i]='g';break; case 8: letter[i]='h';break; } num[i]=c; if(i==ncuad) s=1; while(j<8 && s==0){ if((f+pos_f[j])>0 && (f+pos_f[j])<=n) if((c+pos_c[j])>0 && (c+pos_c[j])<=n) search(i+1,f+pos_f[j],c+pos_c[j]); j++; } board[f][c]='0'; } } int main(){ int i,j; scanf("%d",&n); ncuad=n*n; init_board(); for(i=1;i<=n;i++) for(j=1;j<=n;j++) search(1,i,j); if(s){ for(i=1;i<=ncuad;i++) printf("%c%d ",letter[i],num[i]); return 0; } else printf("IMPOSSIBLE\n"); return 0; } if someone can help me I would appreciate a lot!! Precalc (-) Dmitry 'Diman_YES' Kovalioff 12 May 2005 12:22 else begin writeln('a1'); writeln('b3'); writeln('a5'); writeln('b7'); writeln('d8'); writeln('c6'); writeln('b4'); writeln('a2'); writeln('c3'); writeln('b1'); writeln('a3'); writeln('b5'); writeln('a7'); writeln('c8'); writeln('b6'); writeln('a4'); writeln('c5'); writeln('a6'); writeln('b8'); writeln('d7'); writeln('f8'); writeln('e6'); writeln('d4'); writeln('c2'); writeln('e3'); writeln('d1'); writeln('b2'); writeln('c4'); writeln('d6'); writeln('e8'); writeln('g7'); writeln('f5'); writeln('e7'); writeln('g8'); writeln('f6'); writeln('h7'); writeln('g5'); writeln('e4'); writeln('d2'); writeln('f1'); writeln('h2'); writeln('f3'); writeln('e1'); writeln('g2'); writeln('h4'); writeln('g6'); writeln('h8'); writeln('f7'); writeln('h6'); writeln('g4'); writeln('e5'); writeln('d3'); writeln('c1'); writeln('e2'); writeln('g1'); writeln('h3'); writeln('f2'); writeln('h1'); writeln('g3'); writeln('h5'); writeln('f4'); writeln('d5'); writeln('c7'); writeln('a8'); end; thanks! but can I ask you two questions...? first, how many time takes in your computer if you run my code to get the solution for n=8? because my computer is veryy slow and get stuck and number two is it any way to solve it the problem without precalc?? (sorry for my bad english) and thanks again!!! :D:D:D:D:) byee! and good luck! I didn't use precalc. I calculated answer for N using answer for N-1 if it was not 'No Solution' I took first N moves from it. Use the priority array for the chessboard : void init() { int a,b,c; int chessboard[8][8]={0}; int direction[8][2]= { {2,1},{-2,1},{2,-1},{-2,-1}, {1,2},{-1,2},{1,-2},{-1,-2}, }; for(a=0;a<n;a++) { for(b=0;b<n;b++) { int count=0; for(c=0;c<n;c++) { int x1 = a+direction[c][0]; int y1 = b+direction[c][1]; if(x1>=0&&x1<n&&y1>=0&&y1<n) count++; } chessboard[a][b] = count; } } } For example, n = 8 : 2 3 4 4 4 4 3 2 3 4 6 6 6 6 4 3 4 6 8 8 8 8 6 4 4 6 8 8 8 8 6 4 4 6 8 8 8 8 6 4 4 6 8 8 8 8 6 4 3 4 6 6 6 6 4 3 2 3 4 4 4 4 3 2 go to the cell with minimum priority first ! Good luck ! Edited by author 17.02.2009 12:04 Edited by author 17.02.2009 12:04 How can here be >=10 tests if 1<=n<=8? |
|
|