| Show all threads Hide all threads Show all messages Hide all messages |
| WA #14 | zaitsevmishka | 1200. Horns and Hoofs | 27 Dec 2016 21:04 | 1 |
WA #14 zaitsevmishka 27 Dec 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. Very Short Problem | 27 Dec 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. Spell Checker | 27 Dec 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!!! |
| Best algo you have(mine is O(Q^2*N)) | Elias | 1018. Binary Apple Tree | 25 Dec 2016 17:35 | 3 |
Hello! Can somebody tell me if there is a faster algo than O(Q^2*N)? My algo works pretty fast, but I wondered if there is a better way to do it. My solution Q*N, lol Or no I'm not sure Edited by author 11.03.2016 21:50 Edited by author 11.03.2016 21:50 My algo is fills dp[vertex][presaved edges] array (result is dp[1][Q]), where total loops N^3/6 < 2*10^5. There maximum presaved edges = Q, but more vertexes have less edges than Q. Let edges[v] - number of edges of v vertex. So there O( N * sum( edges[ v ] * ( edges[ v ] + 1 ) / 2 ) ) = O( N^3 / 6 ). |
| you have WA#7!!! | Bobur | 1123. Salary | 25 Dec 2016 06:17 | 3 |
you must write "not eoln" no "not eof" and you'll got AC!! THANK YOU!!! Very much! Had WA1. Got desperate, rly, can't find any mistakes. Can't believe it was it. Change this tiny word and get AC! Still, why it makes such difference? |
| cpp ac code | Grigory 'Stargazer' Javadyan [RAU] | 1089. Verification with the Dictionary | 23 Dec 2016 21:49 | 3 |
cpp ac code Grigory 'Stargazer' Javadyan [RAU] 20 Oct 2008 16:02 #include <iostream> #include <vector> #include <string> int corrections = 0; bool words_match(const std::string& w1, const std::string& w2); void process_word(const std::vector<std::string>& dict, const std::string& word); int main(){ std::vector<std::string> dictionary; std::string curr_dict_word; std::getline(std::cin, curr_dict_word); while(curr_dict_word != "#"){ dictionary.push_back(curr_dict_word); std::getline(std::cin, curr_dict_word); } char c; std::string cword; while(std::cin.read(&c,1)){ if('a'<=c && 'z'>=c){ cword.insert(cword.end(), c); continue; } else if(!cword.empty()){ process_word(dictionary, cword); cword = ""; } std::cout << c; } if(!cword.empty()){ process_word(dictionary, cword); } std::cout << corrections << std::endl; return 0; } bool words_match(const std::string& w1, const std::string& w2){ if(w1.length() != w2.length()){ return false; } bool mismatch = false; for(int i = 0; i < w1.length(); ++i){ if(w1[i] != w2[i]){ if(mismatch){ return false; } mismatch = true; } } return mismatch; } void process_word(const std::vector<std::string>& dict, const std::string& word){ for(int i = 0; i < dict.size(); ++i){ if(words_match(dict[i], word)){ std::cout << dict[i]; ++corrections; return; } } std::cout << word; } Please don't post your solution here. |
| Why is problem in dp topic??? | Anatolich | 1221. Malevich Strikes Back! | 23 Dec 2016 19:40 | 1 |
Maybe there is just small limits or not right topic?? |
| How to solve it fast? | Livace | 1422. Fireflies | 22 Dec 2016 18:09 | 1 |
My solution is O(n^2*logn) and works ~1.7 seconds. But some people got AC in .078. How? |
| How to solve it fast and cool? | Laise | 1063. Domino Puzzle | 22 Dec 2016 13:27 | 2 |
I solved it with next algo: I bruteforce all possible connections (if graph consists of several not connected parts) and then add some edges for Euler path with greedy. Of course its right algo, but some complicated (i think). Does anyone knows more simple one? Only use buffered i/o )). |
| wa 20 | Arsen | 1297. Palindrome | 22 Dec 2016 10:53 | 1 |
wa 20 Arsen 22 Dec 2016 10:53 |
| Обратный корень Java | Ilimsky | | 21 Dec 2016 21:35 | 2 |
Подскажите кто нибудь что я делаю неправильно? import java.util.*; import static java.lang.Math.*; public class Sqrt{ public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.println(sqrt(in.nextInt())); } } |
| Did the problem without using binary search. However it takes 0.109 seconds. | bluestar | 1880. Psych Up's Eigenvalues | 20 Dec 2016 22:28 | 2 |
The main method I followed was to first compare two of the arrays and extract the similar values in another array. I then compared that array with the third array, and updated the counter each time there was a match in eigenvalues. This method avoids comparing all the arrays together, and hence takes up less time. So in essence number of operations reduces to O(2*N^2) instead of O(N^3). However, more sophisticated algorithms like binary search are more effective. But still I include this method for people like myself, who are new to algorithms. Hope it helps someone. Thank you! Did as you said and get Accepted)) 0.046 seconds (FreePascal) |
| Any hints? | Programmer | 1790. Searching for the Truth | 20 Dec 2016 21:36 | 2 |
Any hints for this problem? Try solve 2 sub problems when dodecahedron on odd position and not. |
| What's wrong with my code? (Pascal) | genchildren | 1001. Reverse Root | 20 Dec 2016 02:59 | 4 |
var j,i,n:longint; m:array of real; begin n:=1; while not seekeof do begin read(j); SetLength(m,n); m[n]:=sqrt(j); inc(n); end; for i:=n to 1 do writeln(m[i]:0:4); end. 1. chek type of j. You may have input = 10^18, but max in longint ≈ 2*10^9. 2. Write size of array. 2. Don't know what this is: SetLength(m,n); delete this nah) 3. for i:=n to 1 do |=> for i:=n downto 1 do 4. Chek why for this input: 9. your output is 0.0000 3.0000 little change your programm and get AC)) Edited by author 18.12.2016 03:29 |
| If you want more fast code submit your solution to night , really :))) | c_pp | 1019. Line Painting | 20 Dec 2016 02:37 | 1 |
|
| WA9 | Stanislav Beskorovainiy | 1123. Salary | 19 Dec 2016 19:29 | 1 |
WA9 Stanislav Beskorovainiy 19 Dec 2016 19:29 I don't understand what's wrong in my program. Give me test 9 please |
| Why this problem rejudged?? | Shen Yang | 1415. Mobile Life | 19 Dec 2016 13:11 | 1 |
is there something invalid in test cases?? |
| What is in the test 26? | [kubsu] Eugene Kudinov | 1378. Artificial Intelligence | 18 Dec 2016 22:11 | 1 |
Help! What is in the test 26? |
| How to get speed 0.001 seconds ???? | Ruben Ashughyan | 1048. Superlong Sums | 18 Dec 2016 15:47 | 5 |
-- use fread | fwrite; -- do not use << if >> statement or minimize it; -- minimize div and mod operations ( % , / operators); -- instead of % , / operators may to use pre-calculated arrays. -- and last, need lucky :) 10^6 numbers --> input file size ~4 Mbytes, and output file size ~1 Mbytes. MY PC i-core 3 , 3 GB RAM, gcc 5.4.0 with option: g++ -Wall -O3 -std=c++14 reads/writes took 6-9 milliseconds. So there need something magic tricky to solve this with time < 1 milliseconds !!!!! I got 0.001s AC!! buffered i/o helped me. Your program ate 12 Mb memory. So I suppose you are reading the whole numbers and then do addition. It isn't necessary. It's possible to add numbers digit by digit (yes, from high digits to low) without any arrays usage - 0.3s even using scanf/printf. And yes, use fread/fwrite. Edited by author 13.12.2016 22:15 |
| Heeeh) Wa8 | Rocky.B | 1741. Communication Fiend | 17 Dec 2016 20:13 | 1 |
Forgot to sort the updates :) |