| Show all threads Hide all threads Show all messages Hide all messages |
| WA 2. Can someone tell me why. | Dev | 1196. History Exam | 15 Mar 2015 15:57 | 1 |
Can someone tell me the test case 2 please. |
| 1017. Staircases HELP | Doro | | 14 Mar 2015 15:32 | 1 |
I am new in here and I need some help with 1017. Staircases. Edited by author 14.03.2015 15:34 Edited by author 14.03.2015 15:34 |
| WA #11 | wxy | 1601. AntiCAPS | 14 Mar 2015 14:23 | 2 |
What may it be? i've try any test i can think and any test in other discussins,but still WA #11. I tested : ------- WHAT ARE YOU DOING? - I AM EATING. - really? -Yes,(new line) REALLY! - ok, i KNOW. i TRUST YOU. ------- and my program output : ------- What are you doing? - I am eating. - Really? -Yes, really! - Ok, i know. I trust you. ------- I don't know what's wrong, help, please. Re: WA #11 Who calls the Dragon Knight? *_* 14 Mar 2015 14:23 It must be "i trust you." not "I trust you" |
| Ruby non, C++ oui | Donald Cameron | 1044. Lucky Tickets. Easy! | 14 Mar 2015 08:08 | 1 |
For my first try I wrote this: def sum_of_digits(n) sum = 0 while (n > 0) sum += n % 10 n /= 10 end sum end num_digits = gets.chomp.to_i exponent = num_digits/2 divisor = 10**exponent limit = (10**num_digits) - 1 total = 0 0.upto(limit) do |cur| upper = cur / divisor lower = cur % divisor total += 1 if sum_of_digits(upper) == sum_of_digits(lower) end puts total # eof For 2, 4 and 6 digits it got the requisite answers of 10, 670, and 55252. There was a bit of a pause while it crunched away at the 6-digit case, though. For 8 digits it … well, I let it run and went to do something else. Then I had the bright idea to time it (on mac OS X, using the time command): 4816030 real 1m42.596s user 1m34.222s sys 0m1.837s The right answer, but the last time I checked, one minute anything was greater than two seconds. What to do? It’s pretty clear that calling sum_of_digits a bunch more times than necessary is the biggest problem. For try #2, I precomputed the sums and stuffed them into an array, and indexed the array in place of calling sum_of_digits in the main loop. Here’s the result: time ruby lucky.rb < t8.txt 4816030 real 0m19.176s user 0m18.017s sys 0m0.313s A better than 80% speedup. Most times I would kill for that, but I still need to lose 95% of the remaining run time. How to do it? I checked … initializing the array of sums takes virtually no time, even if I write out the entire array contents to a file. So the main loop is killing me, and unfortunately I need a dramatic change of algorithm but I don’t see one. So … 1. Recode in C or C++ 2. Hell if I know Taking option 1, I got Accepted, with run times around 1.1 seconds or so for 8 digits. It's a straightforward translation to C++, very brute force. |
| If you keep getting WA#13 | PrankMaN | 1200. Horns and Hoofs | 13 Mar 2015 22:37 | 1 |
Try this test: -1 -1 1 Answer: 0.00 0 0 |
| Nice problem :) | Radoslav Dimitrov | 1067. Disk Tree | 11 Mar 2015 01:22 | 1 |
Solved it with time of 0.5 sec and using "Trie" where I keep the name of each directory as a node. |
| I get AC | novopashinwm | 2035. Another Dress Rehearsal | 10 Mar 2015 13:48 | 1 |
Write me novopashinwm@mail.ru |
| WA 5. Give me some tests, please | Eduard | 2032. Conspiracy Theory and Rebranding | 9 Mar 2015 21:24 | 1 |
Give me some input values with answers, please, so I could find out, what's wrong. |
| for wrong #4 | Bahodir | IT of TUIT | | 1573. Alchemy | 7 Mar 2015 22:44 | 1 |
if(s.equals("Blue")|| s.equals("blue")) if(s.equals("Red") || s.equals("red")) if(s.equals("Yellow") || s.equals("yellow")) |
| Combinatorial | _UnderScore | 1044. Lucky Tickets. Easy! | 7 Mar 2015 12:51 | 3 |
Can anybody explain the combinatorial approach of this problem ??? Greetings the solution is very simple, combinatory isn't needed ;) I think it is coz brute force would be a good pain in ass with n > 9. But if u find a general solution with combinatorics it would be very efficient. I could not find one, though. |
| Java. Wrong answer. Test 2. | Daniil | 1001. Reverse Root | 6 Mar 2015 20:40 | 2 |
import java.io.*; import java.lang.*; import java.util.*; public class MathSqrt { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); double[] array = new double[4];
for(int i = 0; i < array.length; i++) { array[i] = sc.nextDouble(); }
for(int i = array.length - 1; i >= 0 ; i--) { double b = Math.sqrt(array[i]); System.out.println(b); }
} } Edited by author 18.02.2015 17:39 Edited by author 18.02.2015 17:39 Why length of your array is 4? It's acceptable to the first test, but there is not a certain amount of numbers in the task. |
| TL help me | Nodirbek Islomov | 1989. Subpalindromes | 6 Mar 2015 14:25 | 2 |
Hint: A string is palindrome if (and only if) its "RIGHT to LEFT" hash and "LEFT to RIGHT" hash are the same. Also for "Change" queries you need to use some data structure, such as Fenwick Tree or Segment Tree. Edited by author 06.03.2015 14:26 Edited by author 06.03.2015 14:26 |
| What is test 1? | novopashinwm | 2035. Another Dress Rehearsal | 6 Mar 2015 12:48 | 1 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _2035 { class Program { static void Main(string[] args) { string[] arrS = Console.ReadLine().Split(' '); long a = long.Parse(arrS[0]); long b = long.Parse(arrS[1]); long c = long.Parse(arrS[2]); //10^9 =1 000 000 000 if (((c - b) > a && (c-b)>0)) Console.WriteLine("Impossible"); else if (((c - a) > b && (c-a)>0)) Console.WriteLine("Impossible"); else if ((c - b) > 0 ) Console.WriteLine("{0} {1}", (c - b), b); else Console.WriteLine("{0} {1}", (c - a), a);
} } } Edited by author 06.03.2015 12:54 |
| If you get WA3 | Tural Neymanov | 2024. Adventure Time | 4 Mar 2015 21:58 | 2 |
Notice that k maybe be bigger than n. |
| test #11 | Alexander Bondarenco | 2014. Zhenya moves from parents | 4 Mar 2015 21:47 | 1 |
test #11 Alexander Bondarenco 4 Mar 2015 21:47 Could anyone provide any information about the 11-th test? |
| Why i don't get AC? | novopashinwm | 1248. Sequence Sum | 4 Mar 2015 19:48 | 1 |
This is my programm below: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Globalization; namespace _1248 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); double s = 0; for (int i = 0; i < n; i++) { string strS = Console.ReadLine(); double ch =0; if (strS.Contains("e")) { string[] arr = strS.Split('e'); double ss = double.Parse (arr[1]); ch = double.Parse(arr[0], CultureInfo.InvariantCulture) * Math.Pow(10, ss); } else ch = double.Parse (strS ); s +=ch; } StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0:0.000000000000000000e0}", s); string sss = sb.ToString(); sss = sss.Replace(',', '.'); //sss = sss.Replace("e0", ""); Console.WriteLine(sss); } } } |
| WA #1 Please Help :( Alteast give me test case | alok13alok | 1263. Elections | 4 Mar 2015 19:12 | 1 |
import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Scanner; public class Election { static long count; public static void main(String agrs[]) { Scanner scan = new Scanner(System.in); long N = scan.nextInt(); long N1 = scan.nextInt(); DecimalFormat form = new DecimalFormat("0.00"); ArrayList<Integer> array = new ArrayList<Integer>(); for (int i = 0; i < N1; i++) { array.add(scan.nextInt()); } for (int i = 1; i <= N; i++) { for (int j = 0; j < N1; j++) { if (array.get(j) == i) { count++; } } System.out.println(form.format((count * 100) / N1) + "%"); count = 0; } } } =================== Cant find any error. :( |
| right or wrong? 1170-desert | svr | 1170. Desert | 3 Mar 2015 06:44 | 7 |
Right or wrong my answer to the next test? 10 1 1 2 2 3 10 1 11 2 1 5 5 6 7 2 3 4 8 7 3 1 3 9 9 3 12 11 15 12 1 3 3 6 6 2 4 6 8 10 3 3 7 4 12 3 2 5 4 7 2 4 50 rez: 107.071068 35.355339 35.355339 and this one: 10 1 1 2 2 8 10 1 11 2 1 5 5 6 7 2 3 4 8 7 3 1 3 9 9 3 12 11 15 12 6 3 3 6 6 5 4 6 8 10 3 3 7 4 12 3 2 5 4 7 2 4 50 rez: 153.263903 19.695965 45.957252 Edited by author 21.11.2007 14:15 Edited by author 15.03.2008 10:46 Edited by author 15.03.2008 10:49 On the first test my AC prog gives 179.034852 36.857707 33.786231 On the second case 191.055728 22.360680 44.721360 Your angle is correct, but the time delay is NOT. My AC programme said that time delay is: 1. 171.265415 2. 184.347524 Good luck~ My AC program got the same answer as 198808xc. Given tests contain nested/overlaped rectangles. And original tests dont (problem statement is not clear enough concerning this, though). Hence, different AC solutions may return different result, these tests don't make sense. |
| If you have TL (with recursion) | Evgeny Shulgin | 1353. Milliard Vasya's Function | 1 Mar 2015 13:05 | 1 |
Let your recursion function is "void dfs1(int k, int curr)", k is digit, curr is current S, then use it code: int start = 0; start = max(start, curr - 9 * (k - 1)); int end = min(9, curr); if(k == 10) { end = min(1, end); } for(int i = start; i <= end; i++) { dfs1(k - 1, curr - i); } It turns out, curr does not go beyond zero at k = 0! I have 937ms with this solution But with precalc I have 31ms :) Good luck |
| Easy way to think about the problem (hint) | Steve | 1820. Ural Steaks | 28 Feb 2015 23:36 | 4 |
Think about how many sides of steaks you need to cook, not in terms of whole steaks. Except you can't cook both sides at the same time (when k > n). AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Thanks!!!! Half a day was decided. Thanks. I was missing the except part. :) |