| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA on Case#14 | Iftekher Toufique Imam | 2034. Корованы | 23 янв 2018 20:14 | 1 |
Passed all the test given in the discussion I ran 1 bfs from 'r' and another bfs from 's' where i also kept data for those nodes who can have multiple parents. than I while restoring path from destination to source I selected the node who has higher level from 'r' (that selection occurs if only the node has possibility multiple parents) returned the ans which is the minimum among the final path |
| To Who do not know the meaning of N and K | an phan | 1009. K-ичные числа | 23 янв 2018 12:30 | 5 |
I got AC with 0.015s,216Kb I had read the problem several time until understand. N is the length of the digit number. It will be something like that a1 a2 a3 ...an for each ai in a1 a2 a3..an, 0 <= ai < K. The output number i used was interger (compiler C++ 2010). (no big number). hope it can help you. And sorry for my poor English. Edited by author 25.04.2014 23:05 thanks an phan. through your post, i have understanded a bit. but why K = 10. when a1 a2 a3....an <10 and lager or equal 0. i thinks result = 99. why 90? i suspect it? Thanks you so muck. From task: > 0001235 is not a 7-digit number, it is a 4-digit number. So first zero isn't allowed. So, 0 < a1 < 10 0 <= a2...an < 10 Result is 9*10 = 90 Maybe you just thought "00" is not the valid number, but the problem said "0001235 is not a 7-digit number, it is a 4-digit number. ", that means 01, 02...09 are not 2-digit numbers, they are 1-digit numbers, so the answer should be 90. Dear anphan . Your question is jam <3 <3<3 |
| Runtime error (Access violation) at Case #9 (C++) | Meraj al Maksud | 1001. Обратный корень | 23 янв 2018 03:00 | 1 |
https://ideone.com/Ocpa4V I can't figure out what's wrong with my code. I used 'Queue' data structure. Edited by author 23.01.2018 16:02 |
| Почему WA 1? | DarkSun1997 | 1108. Наследство | 22 янв 2018 21:49 | 7 |
#include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<string> #include<cmath> using namespace std; vector<long long > C(20000,0); void mult(vector<long long> A,vector<long long> B) { int d=0; for(int i=0;i<300;i++) { for(int j=0;j<300;j++) { C[i+j]+=B[i]*A[j]; C[i+j+1]=C[i+j+1]+C[i+j]/100000000; C[i+j]=C[i+j]%100000000; } } C[0]++; for(int i=0;i<6000;i++) { C[i+1]=C[i+1]+C[i]/100000000; C[i]=C[i]%100000000; } } vector<long long> D(20000,0); void mult1(vector<long long> A,vector<long long> B) { int d=0; for(int i=0;i<300;i++) { for(int j=0;j<300;j++) { D[i+j]+=B[i]*A[j]; D[i+j+1]=D[i+j+1]+D[i+j]/100000000; D[i+j]=D[i+j]%100000000; } } for(int i=0;i<6000;i++) { D[i+1]=D[i+1]+D[i]/100000000; D[i]=D[i]%100000000; } } void write(vector<long long> A) { bool f=false; for(int i=9999;i>=0;i--) { if(A[i]!=0) f=true; if(f) cout<<A[i]; } cout<<"\n"; } int main() { #ifdef _DEBUG freopen("input.txt","rt",stdin); freopen("output.txt","wt",stdout); #endif int n; cin>>n;
vector<long long> A(10000,0); vector<long long> B(10000,0); A[0]=1; B[0]=1; for(int i=0;i<n;i++) { mult(A,B); mult1(A,B); for(int i=0;i<4000;i++) { B[i]=D[i]; } for(int i=0;i<4000;i++) { A[i]=C[i]; } for(int i=0;i<4000;i++) { C[i]=0; D[i]=0; } write(A); } } Вот код, скорее всего он не пройдет макс тест, но при запуске на первом тесте он выдает мне в студии ответ правильный, а тут нет Потому что первый тест не совпадает с примером. Попробуйте отправить программу, которая выводит "2\n3\n" и вы убедитесь. ну у тебя и решение.... все ведь должно быть гораздо проще, хотя я тоже первый тест не могу пройти #include <stdio.h> long long int l; int m(int i) { int res; if (i == 0) { l = 2; return 2; } res = l + 1; l *= res; return res; } int main() { int n, i, k; scanf("%d", &n); for (i = 0; i < n; i++) printf("%d\n", m(i)); return 0; } По приколу, я сдал задачу. [code deleted] Edited by moderator 08.04.2020 21:07 WA#1 у меня потому, что я проверял, действительно ли первый тест -- это N=2 Я думаю, что здесь всего 1 тест сразу для случая, когда N=18. Лично я начал считать максимальные значения на калькуляторе и пришёл к одной закономерности. I think that there is only one test right here for the case when N = 18. Personally, I started to count the maximum values on the calculator and came to regularity. |
| What does it mean?(Что это означает) | daminus | 1677. Обезьяна за клавиатурой | 22 янв 2018 15:37 | 2 |
I don't understand!!! How given (2, aa) answer is 6. I think that must be 4!!! Please help, who know that!!!!! (Я не понел Как 2 и аа могут дать ответ 6 Я думаю что должно быть 4 Помогите------------) expected time is inifinite sum of time * p(time), where p(time) is the probability to get resulting string exactly in 'time' steps. for aa: probability to get 'aa' in exactly 1 step is 0. (simple) probability to get 'aa' in exactly 2 steps is 1/4 (simple) probability to get 'aa' in exactly n steps is probability to get a string of length == n - 1 that ends with 'a', and doesn't contain 'aa' as substring multiplyed by 1/2 (when you have such string there is a 1/2 chance that the next character will be 'a'). for n == 3: 1/8, for n == 4: 1/8 etc. If you simulate such steps and get a sum for n = [2.. 10000] you will get answer equal to 6 PS. this is simulation of 10 steps: 0.000000 * 1 0.250000 * 2 0.125000 * 3 0.125000 * 4 0.093750 * 5 0.078125 * 6 0.062500 * 7 0.050781 * 8 0.041016 * 9 0.033203 * 10 |
| Need Help TEAST CASE5 | Dewesh Deo Singh | 1119. Метро | 22 янв 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. Такси | 20 янв 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. Вавилонская рыбка | 20 янв 2018 08:25 | 1 |
try to change your variables to double, and don't use int. |
| How about case M>N(+)? | SPIRiT | 1580. Долги декана | 20 янв 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. Трудности перевода | 18 янв 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. Дебютный альбом | 18 янв 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. Лишние пробелы | 18 янв 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. Полутона | 17 янв 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. Поворот на МЕГУ | 17 янв 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. Войны туземцев | 16 янв 2018 07:51 | 1 |
|
| wrong 8 why?? | Nursat Yermakhanbet | 1567. SMS-спам | 16 янв 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. Круговая порука | 16 янв 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 янв 2018 20:09 | 1 |
Test 11 mouse_wireless2 15 янв 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. Трудности локализации | 15 янв 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. Ниточка | 15 янв 2018 05:46 | 1 |
Edited by author 15.01.2018 06:34 |