| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA1 or WA9 | Contego | 1226. йынтарбО кодяроп | 17 авг 2015 15:07 | 1 |
The output text must be exactly as it was given, without any additional new lines (but with all new lines that were in input data). |
| Thanks to authors!!! I like this problem! | __Andrewy__ | 1358. Провода | 16 авг 2015 19:58 | 1 |
My algo works O(N). It's the fastest algo because the problem has O(N) data. Edited by author 16.08.2015 20:04 |
| test#11 to admins!!! | AndrKonin | 1353. Миллиардная Функция Васи | 16 авг 2015 03:17 | 2 |
what is 11 test? I think I checked everything possible variants? can you help me? It was replied to before. 75501. |
| I'm getting WA on TEST 2 can anybody give a test plz???! | kerpoo | 1934. Чёрная метка | 15 авг 2015 23:35 | 3 |
used dijkstra and update the probability (distance in normal dijkstra) of node v for v like below: dis[father[v]]=dis[father[v]] + edge(father[v],v).value - dis[father[v]]*edge(father[v],v).value is there any problem?! I'm not good enough in probability theory... Edited by author 15.08.2015 22:01 dijkstra doesn't do the job the problem asks for the <<shortest path>> even if it isn't the minimum of all ( but of course it should be minimal among all shortest path) tnx! I wasn't so careful in reading the problem! |
| Tests | __Andrewy__ | 1497. Разрезание квадрата | 15 авг 2015 19:06 | 1 |
Tests __Andrewy__ 15 авг 2015 19:06 1)3 111 111 111 yes 2)3 111 101 111 no 3)5 11100 10000 00011 11000 00000 no 4)5 11111 00011 01111 00001 00111 yes |
| Wrong Answer: Can't Understand Why! | Ashfaqur Rahman | 1001. Обратный корень | 15 авг 2015 12:23 | 1 |
I am getting wrong answer. But output is identical in my computer. Here is my code - #include <stdio.h> #include <math.h> #define ARRSIZE 32768 int main(){ unsigned long int n, a[ARRSIZE]; int i = -1; while(!feof(stdin)){ i++; scanf("%lu", &n); a[i] = n; } i--; for(; i >=0; i--){ printf("%0.4lf\n", sqrt(a[i])); } return 0; } |
| Idea | __Andrewy__ | 1433. Тетраэдры | 14 авг 2015 23:02 | 1 |
Idea __Andrewy__ 14 авг 2015 23:02 1 2 3 4 1 3 4 2 1 4 2 3 2 4 3 1 2 3 1 4 2 1 4 3 3 2 4 1 3 4 1 2 3 1 2 4 4 2 1 3 4 1 3 2 4 3 2 1 Edited by author 14.08.2015 23:03 |
| what's the case answer? | Glory | 1057. Количество степеней | 14 авг 2015 09:30 | 1 |
111 211 3 10 the answer is 0 or 1... why? thanks you.. |
| WA #7 Test | Konstantine Muradov | 1327. Предохранители | 14 авг 2015 03:08 | 1 |
Hello, here is my code using System; public class Program { public static void Main(String[] args) { var a = Convert.ToInt32(Console.ReadLine()); var b = Convert.ToInt32(Console.ReadLine()); var ans = (b-a + 1) / 2; if (b % 2 > 0) ans++; Console.WriteLine(ans); } } I can not find out the problem :( |
| Special case test | 👨🏻💻 Spatarel Dan Constantin | 1888. Стаж пилотов | 13 авг 2015 22:38 | 2 |
Here is a special case test: Input: 2 4 1 2 3 4 Possible output: 49 1 2 50 49 Thanks for test! Your test help me to understand the problem |
| One of the solutions | Denis Rozimovschii | 1613. Для любителей статистики | 13 авг 2015 20:27 | 1 |
Create an unordered map <int, set <int> > and for each number in the input insert it's index to the corresponding position in the map, then for each query use manipulations with upper_bound in the set. Looks like O(nlogn + qlogn). Edited by author 13.08.2015 20:29 |
| Could anyone EXPLAIN his/her solution of this problem? (i know how it can be solved) | Alex[LSD] | 1295. Бред | 13 авг 2015 16:18 | 8 |
well the way i thought is simply calculate the number and see but before using numbers i used long's and calculated it %10000 and that was enough i used the writing in binar of the number n to calculate it in logn yes...no need for crazy calculations...just check out the answers for some numbers and u'll see how easy this problem is.. I don't think it is eas to find the period. display the situation of n: 1- 100 ? 1 - 30 is enough actually |
| WA in 54 | olimpo | 1780. Код Грея | 13 авг 2015 15:34 | 3 |
I got Wa in 54,either have you figure out that. Edited by author 13.08.2015 15:09 I found the problem . I do this using DP,dp[i][0] dp[i][j] represent the ways to put '0' and '1' and the answer to too big for long long . So for this problem (only ask for ok or not ok)just set a max range ,when dp[i][j]>max just let dp[i][j]=max. Hope help. |
| solution hints, just simple math on modulo | Md. Shahedul Islam (Shahed) | 1295. Бред | 13 авг 2015 15:15 | 1 |
if {(1^n + 2^n + 3^n + 4^n) % 10} is equal to 0, then we find 1 zero. if {(1^n + 2^n + 3^n + 4^n) % 100} is equal to 0, then we find 2 zeros. and so on.... now, how to calculate {(1^n + 2^n + 3^n + 4^n) % 10}: Look, {(1^n + 2^n + 3^n + 4^n) % 10} =((1^n % 10) + (2^n % 10) + (3^n % 10) + (4^n % 10)) % 10 [simple modulo equivalencies] now, (4^n % 10) = ((((((4%10)*4)%10)*4)%10)*4)%10 . . . . . . . (n times) [(4%10), then multiply by 4, then mod 10, loop for n times] similarly for (2^n % 10) and (3^n % 10). No need for 1, because (1^n % 10) is always 1. In this way, calculate the rusult of {(1^n + 2^n + 3^n + 4^n) % m} for m = 10, 100, ans so on... and count zeros... :) ** to know more about modulo equivalencies, http://en.wikipedia.org/wiki/Modulo_operation ** solution C++: (don't see the solution before trying, at first try yourself) http://github.com/shahed-shd/Online-Judge-Solutions/blob/master/Timus-Online-Judge/1295.%20Crazy%20Notions.cpp Edited by author 13.08.2015 15:51 Edited by author 13.08.2015 23:02 |
| To those, who had WA. | Yermak | 1750. Пахом и овраг | 12 авг 2015 16:45 | 8 |
Deleted. Edited by author 24.01.2010 03:44 Here is some useful tests (after passing all of it I got AC): 14 1 1 3 3 0 2 2 2 2 0 2 2 6 1 -1 1 5 6 5 0 2 2 0 3 -1 1 5 6 5 0 2 2 -4 0 -1 1 5 6 5 0 2 2 6 7 -1 1 5 6 5 0 2 2 5 7 -1 1 4 6 5 0 1 1 6 6 2 2 3 3 4 4 1 1 6 6 2 4 3 3 4 2 1 1 2 2 -1 -1 -1 -2 -2 -1 1 1 3 3 4 6 2 2 6 4 1 1 3 3 4 6 1 2 6 4 1 1 3 3 4 6 1 2 7 4 1 1 2 2 1 3 3 3 3 1 1 1 1 5 0 8 1 2 3 2 Answer: 4.576491 5.019765 5.398346 6.324555 10.676619 10.605551 7.071068 7.634414 1.414214 8.993230 8.993230 9.162278 1.414214 5.841619 Good Luck :) some more: 2 2 2 4 2 2 1 3 6 4 1 4 2 2 2 2 1 3 6 4 1 4.000000 4.000000 My WA4 passed all having tests, but it had problems with something like this 2 8 7 1 3 6 1 7 4 0 9 5 1 2 2 2 1 4 1 8 9 11,709720 4,000000 Yet tests: 5 5 2 3 5 -1 2 4 5 6 3 4 1 5 5 2 3 6 4 5 2 1 1 7 5 2 3 6 4 5 2 1 1 3 3 2 4 2 2 4 2 6 1 6 4 0 5 7 2 6 5 answers: 5.242641 5.064495 7.621233 4.576491 5.576491 And don't use float! When I use float system reply WA#4, after s/float/double/ I get AC. Edited by author 18.01.2011 00:00 |
| Solving with heap | Denis Rozimovschii | 1306. Медиана последовательности | 11 авг 2015 20:58 | 1 |
Spoiler alert!!! I've been struggling a lot with make_heap(), pop_heap() and push_heap(), but I decided to make my own heap structure and got Accepted Here's the structure (not the solution) : http://pastie.org/10344200 |
| if you have wa4 | Innokentiy | 1602. Лифт | 10 авг 2015 17:13 | 1 |
check the test where answer is 1 |
| O(N^2). Is there better solution? | Oracle[Lviv NU] | 1198. Коррупция | 10 авг 2015 12:58 | 6 |
I divided given graph into biconnected components, and then worked with created DAG. This solution is O(N^2) and runs in 0.203 seconds. But there are solutions with better time. Is there faster algo for this problem? P.S. sorry for bad english(( The input in this problem requires O(N^2) time, so the better complexity cannot be achieved :) Your solution O(N^2*log(N)) in worst case, because the input in this problem requires O(N^2*log(N)) time, so the better complexity than it cannot be achieved. How to divide graph into connected components in O(N^2)? You can use Tarjan's algorithm to find strongly connected components |
| Java AC 3rd place solution | Михаил Аршинов | 1423. Басня о строке | 9 авг 2015 23:39 | 1 |
//package timus; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.util.StringTokenizer; public class p1423 { static char[] t; static char[] p; static int[] pi; static int N; public static void main(String[] args) throws FileNotFoundException { InputStream is = System.in; FastScanner sc = new FastScanner(new InputStreamReader(is)); N = sc.nextInt(); String tt = sc.next(); tt += tt; t = tt.toCharArray(); p = sc.next().toCharArray(); pi = new int[N]; System.out.println(KMPMatcher()); } static int KMPMatcher() { computePrefixFunction(); int equals = 0; for (int i = 0; i < N + N; i++) { while (equals > 0 && p[equals] != t[i]) equals = pi[equals - 1]; if (p[equals] == t[i]) equals++; if (equals == N) { if (i == N - 1) { return 0; } else { return N + N - (i + 1); } } } return -1; } static void computePrefixFunction() { int k = 0; for (int q = 1; q < N; q++) { while (k > 0 && p[k] != p[q]) k = pi[k - 1]; if (p[k] == p[q]) k++; pi[q] = k; } } static class FastScanner { BufferedReader br; StringTokenizer st; FastScanner(Reader in) { br = new BufferedReader(in); } String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } } } |
| 2ADMINS | rip&pvs | 1798. Огненный круг. Версия 2 | 9 авг 2015 22:14 | 2 |
"floor space one million square kilometers", so maximum number of slabs damaged by the fire is 1e12, but brute force solution (TL17) with ad-don "if(res>1e12)res=1e12" has WA14 Statement is fixed, thank you. |