Common Board| Show all threads Hide all threads Show all messages Hide all messages | | what's wrong??? | [SESC USU]Rudnev Vladimir | 1100. Final Standings | 26 Mar 2017 12:39 | 7 | I think, i do all rigth, but i've WA1=(( I don't understand output type, that's mean what me should to print. Sorry for my English... var a,b:array[1..15000]of longint; asd,asd1,n,i,j:longint; begin read(n); for i:=1 to n do read(a[i],b[i]); for i:=1 to n-1 do for j:=i+1 to n do if b[i]<b[j] then begin asd:=b[i]; b[i]:=b[j]; b[j]:=asd; asd1:=a[i]; a[i]:=a[j]; a[j]:=asd1; end; for i:=1 to n do begin write(a[i],' ',b[i]);writeln;end; end. Ou fuck, i've do sort dont rigth.... Ou fuck, i've do sort dont rigth.... I think your solution will be TL. Use merge, or another fast sort I think that you answered two years later than it was necessary :) | | Can't get what's wrong with my BFS solution | ComebackSeason | 1106. Two Teams | 26 Mar 2017 00:55 | 1 | //problem solved (issue of different compilers of my local PC and judge one) Edited by author 26.03.2017 16:41 | | Fine | bdzxt | 1148. Building Towers | 24 Mar 2017 18:48 | 2 | Fine bdzxt 12 Mar 2017 08:23 //tower.in 1000 60 10 1 2 3 4 5 20170312 666666666 888888888 999999999 427749136024120470 427749136024120471 427749136024120472 -1 //tower.out 427749136024120472 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 4 3 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 4 5 6 7 6 7 6 7 8 9 8 7 6 5 6 7 8 9 10 9 8 9 10 11 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 3 2 3 4 3 4 3 4 5 6 7 8 9 8 9 10 11 12 11 10 9 10 9 10 9 10 9 8 9 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 2 3 4 5 6 5 4 5 6 5 4 3 4 5 6 7 8 9 10 9 8 9 8 7 6 7 6 5 4 5 10 9 8 7 6 5 4 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 4 3 4 5 4 5 6 7 8 9 10 9 8 7 8 9 8 9 10 9 8 9 10 11 12 11 12 13 14 13 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 7 6 5 4 3 2 1 2 3 2 1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 7 6 5 4 3 2 3 2 1 2 1 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 8 7 6 5 4 3 2 1 2 1 2 1 I finished it in 0.015s. | | The problem with slow running solutions is fixed | Vladimir Yakovlev (USU) | | 24 Mar 2017 12:39 | 1 | The solutions were judged in a low performance mode for the last two weeks. Now it's fixed, the solutions are being rejudged. | | If you have WA5 | Juve45 | 2070. Interesting Numbers | 23 Mar 2017 13:43 | 1 | Remember that you shouldn't check prime numbers (They call an integer satisfying if they both consider or do not consider this integer to be interesting) | | If you are TLE | yhzq | 1519. Formula 1 | 23 Mar 2017 05:32 | 1 | GET BIGER HASH NUM !!!! If your hash number isn't big enough, you will end up with an endless loop. | | WA1 | maxormo | 1989. Subpalindromes | 22 Mar 2017 08:18 | 1 | WA1 maxormo 22 Mar 2017 08:18 hell why WA1? i wanna get my TLE package main import ( "bufio" "os" "strings" "strconv" ) func main() { in := bufio.NewReader(os.Stdin) out := bufio.NewWriter(os.Stdout) buffer, _ := in.ReadString('\n') str := []rune(strings.Trim(buffer, "\n")) buffer, _ = in.ReadString('\n') count, _ := strconv.ParseUint(strings.Trim(buffer, "\n"), 10, 0) for k := uint64(0); k < count; k++ { buffer, _ = in.ReadString('\n') flds := strings.Fields(buffer) if []rune(flds[0])[0] == 'c' { i, _ := strconv.Atoi(flds[1]) str[i-1] = []rune(flds[2])[0] } else { i, _ := strconv.ParseUint(flds[1], 10, 0) j, _ := strconv.ParseUint(flds[2], 10, 0) if isPali(i-1, j-1, str) { out.WriteString("Yes\n") } else { out.WriteString("No\n") } } } out.Flush() } func isPali(i, j uint64, str []rune) bool { for i < j { if str[i] != str[j] { return false } i++ j-- } return true } Edited by author 22.03.2017 08:19 Edited by author 22.03.2017 08:19 | | To admins. Re: Задача 1196. Экзамен по истории | Nikita UCSD Pascal | 1196. History Exam | 22 Mar 2017 00:35 | 1 | Hallo, On February 1st, 2017 I submitted a solution on Python, which was accepted with the time 0.9 sec. Yesterday I optimised it and submitted, but got "time limit exceeded" message. I then tried my original solution (from 01/02/2017), and it also exceeded time limit. Questions: 1) has something changed in the methodology, or you added some new or modified old tests so it takes more time? 2) is timing dependent on the server load or each solution is tested independently on a dedicated thread? (THis may be a good question for the FAQ) Thank you in advance. | | finally | Anton | 1769. Old Ural Legend | 21 Mar 2017 23:04 | 3 | I'm laughing now .... I've spent about 3 hours for this problem. First off, I used Z-function and I tried to treat problem as a string problem. I generated new string and tried to find it. If there is no, that's the answer. It became not so slow as can seems to be. But TLE#6 got me! Then I tried to store positions for each digit(0-9) and than tried to search target number using binary search for every digit. It works, but not good enough to pass test#6. Then I decided to use the straight approach using bool exists[1000000] that indicates whether n is substring. It approach can be done since total length is 10^5, so 10^6 is free for sure. Since we know several approaches sometimes we use more complex first :) | | WA 5 | Kogut.Ivan | 2095. Scrum | 20 Mar 2017 20:44 | 7 | WA 5 Kogut.Ivan 10 Jul 2016 15:14 Can you give me some tests, please? I don't understand why WA. Re: WA 5 Jane Soboleva (SumNU) 10 Jul 2016 17:44 1 10^9 should be 35682 (apparently? i might be wrong) If you have a few spare gigabytes of RAM, you can simulate the thing by yourself. Initially we have 1 2 3 ... 10^9, after 1st step 1 3 5 etc (+2 +2 +2 etc), after 2nd step it's 1 3 7 9 13 15 (+2 +4 +2 +4 +2 +4 etc), after 3rd step it's 1 3 7 13 15 19 25 27 31 (+2 +4 +6 +2 +4 +6 +2 +4 +6 etc). Only on 4th step it becomes complicated and loses pattern. So for further simulation, you need 1 array of 10^9 / 2 / 2 + 1 4-byte integers from 3rd step (1 and [+2 +4 +6 cycle]), which is ~1GB, and another ~1GB array to copy elements into. I also found the sequence on OEIS: https://oeis.org/A000960, but still, i can't quite understand some things. For example: «To get n-th term, start with n and successively round up to next 2 multiples of n-1, n-2, ..., 1 (compare to Mancala sequence A002491). E.g.: to get 11th term: 11->30->45->56->63->72->80->84->87->90->91; i.e., start with 11, successively round up to next 2 multiples of 10, 9, .., 1. - Paul D. Hanna, Oct 10 2005» — what is this even? I have a hard time understanding what exactly is done here... It means to get n-th number you need to increase n step-by-step. At each step you increase your current number twice to the nearest number divisible by n - 1, n - 2, ..., 1 depending on each step you are now. Example: n = 11, nearest to 11 divisible by 10 is 20, next one is 30. nearest to 30 dibisible by 9 is 36 and next one is 45. And so on 11->30->45->56->63->72->80->84->87->90->91 1 10^9 should be 35682 (apparently? i might be wrong) If you have a few spare gigabytes of RAM, you can simulate the thing by yourself. Initially we have 1 2 3 ... 10^9, after 1st step 1 3 5 etc (+2 +2 +2 etc), after 2nd step it's 1 3 7 9 13 15 (+2 +4 +2 +4 +2 +4 etc), after 3rd step it's 1 3 7 13 15 19 25 27 31 (+2 +4 +6 +2 +4 +6 +2 +4 +6 etc). Only on 4th step it becomes complicated and loses pattern. So for further simulation, you need 1 array of 10^9 / 2 / 2 + 1 4-byte integers from 3rd step (1 and [+2 +4 +6 cycle]), which is ~1GB, and another ~1GB array to copy elements into. I also found the sequence on OEIS: https://oeis.org/A000960, but still, i can't quite understand some things. For example: «To get n-th term, start with n and successively round up to next 2 multiples of n-1, n-2, ..., 1 (compare to Mancala sequence A002491). E.g.: to get 11th term: 11->30->45->56->63->72->80->84->87->90->91; i.e., start with 11, successively round up to next 2 multiples of 10, 9, .., 1. - Paul D. Hanna, Oct 10 2005» — what is this even? I have a hard time understanding what exactly is done here... Re: WA 5 Jane Soboleva (SumNU) 21 Jan 2017 01:51 Thank you! Your explanation is much more clear. Original should probably have "the 2nd closest multiple" instead of "next 2 multiples", would make more sense. 10 18 => 1 666 999 => 6 13 100000 => 354 123456789101112 12345678910111213 => 112837915 1 1000000000 => 35682 1 1000000000000 => 1128378 Edited by author 10.07.2016 18:37 Thanks a lot!!! I got AC. 10 18 => 1 666 999 => 6 13 100000 => 354 123456789101112 12345678910111213 => 112837915 1 1000000000 => 35682 1 1000000000000 => 1128378 Edited by author 10.07.2016 18:37 Re: WA 5 Амир Меннибаев 20 Mar 2017 20:44 Why isn't wrong? 10 18 => 1 Edited by author 20.03.2017 20:45 | | BubbleSort на Java. Возможно ли? | Aleksandr | 1100. Final Standings | 20 Mar 2017 13:06 | 3 | Тут кто нибудь вообще прощёл тест №11 на Java пользуясь именно Bubble Sort? Что то мне подсказывает что это вообще невозможно с такими ограничениями времени. Но в таком случае, почему в задаче упоминается именно пузырьковый поиск? Или всё таки это возможно, а я где то дико туплю? import java.io.*; public class Timus { public static void main (String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter (new OutputStreamWriter(System.out));
int N = Integer.parseInt(in.readLine()), bufer; int ID[] = new int[N]; byte M[] = new byte[N];
for (int i = 0; i<N; i++) { String[] s = in.readLine().split(" "); ID[i] = Integer.parseInt(s[0]); M[i] = Byte.parseByte(s[1]); }
for (int i = 0; i < N-1; i++) for (int j = N-1; j > i; j--) if (M[j]>M[j-1]) { bufer = M[j]; M[j] = M[j-1]; M[j-1] = (byte) bufer; bufer = ID[j]; ID[j] = ID[j-1]; ID[j-1] = bufer; }
for (int i = 0; i < N; i++) out.print("\n" + ID[i] + " " + M[i]);
out.flush(); } } Task doesn't require bubble sort. Task the only require the same sort result. So you can use any stable sort (Collections.sort for example). Тоже не могу пройти 11й тест на питоне, не хватает памяти. Если через словарь делать, то вообще на 1м тесте неправильный ответ, хотя у меня все нормально работает с разными вариантами тестов. | | WA#4 | Nikita | 2073. Log Files | 20 Mar 2017 01:10 | 2 | WA#4 Nikita 16 Apr 2016 22:42 2 Codeforces Gamma Round 512 29.02.16 5 0 URKOP 17.10.15 12 1 A Accepted Re: WA#4 Амир Меннибаев 20 Mar 2017 01:10 | | That testing supercomputer though | Chitanda Eru | 1972. Game Testing | 19 Mar 2017 00:15 | 1 | So, i accidentally wrote a suboptimal solution for this problem (stored entire sequences of settings instead of just singular changes from the previous ones), saw it taking 15s (about 8 without the output) to complete max test on my laptop but submitted for fun anyway. Got AC in 0.4s. Go figure. | | a stronger version | Shen Yang | 1797. Summit Online Judge. Version 2 | 18 Mar 2017 10:48 | 1 | | | Please HELP ME WA 14 | Shohruh_1999 | 1607. Taxi | 18 Mar 2017 09:29 | 1 | #include<iostream> #include<math.h> #include<algorithm> #include<string.h> using namespace std; int a,b,c,d; int main() { cin >> a >> b >> c >> d; int h = c; if(a >= c) { cout << a; return 0; } while(1) { if(a == c) { cout << a; return 0; } a+=b; if(c-d >= a) c-=d; else { if(a > h) cout << h; else cout << a; return 0; } } return 0; } | | How to pass it below 0.015s? | LittlePig | 1584. Pharaohs’ Secrets | 17 Mar 2017 19:37 | 5 | This is one time matching? I used my solution for 1076. | | Max tests | Chitanda Eru | 1159. Fence | 17 Mar 2017 15:37 | 1 | For the max test (a hundred 100's) the answer is 7955128.99. For ninety nine 1m sides and one 98m side it's 397.86. Use this to check your precision. | | Funny. | Mukhametianov Den [USU] | 1159. Fence | 17 Mar 2017 15:32 | 3 | Funny. Mukhametianov Den [USU] 28 Aug 2010 19:10 infin = 100000000 - wa14. infin = 1000000 - ac. Re: Funny. Sergey Lazarev (MSU Tashkent) 4 Jan 2011 23:45 Thank you! But it's very strange. I found the radius using bin search. The right border for search was the sum of all lengths - it must be greater than radius. And I've got WA 14. After changing right border to 10^6 I've got AC. If you try to check a very big radius, the parameter of arcsin gets very low. I assume the function just returns its parameter if it's very close to 0 but your eps needs to be very low as well. Also, the raduis of a polygon's circumscribed circle can be infinitely large no matter what's the upper boundary for its sides is. In this problem, there is a lower boundary too, so you can actually limit your binary search with something. | | If you have WA6 or WA3, you have to look on these tests | KOTMAKRUS [SPbPU] | 1052. Rabbit Hunt | 17 Mar 2017 10:25 | 2 | 6 0 3 0 0 3 0 0 3 1 2 2 1 answer 5 (0 0 is not) 16 15 15 16 17 17 19 18 21 19 23 75 19 16 62 13 69 10 76 7 83 4 90 1 97 -2 104 -5 111 -8 118 -11 125 answer: 10 (last 10) 13 1 1 1 1 1 1 16 62 13 69 10 76 7 83 4 90 1 97 -2 104 -5 111 -8 118 -11 125 answer: 10 (last 10 your program could get 10 in prev test and get 13 here) 8 1 1 1 1 1 1 0 0 0 0 0 0 0 0 2 2 answer 8 5 4 4 4 4 4 4 4 4 4 4 answer 5 I hope, it will help you (P.S. you can click on my nickname and write me, i with big pleasure help you) Edited by author 03.03.2017 22:18 Wrong test cases. No two rabbits are in the same point | | if you get WA #21 | notbot | 1346. Intervals of Monotonicity | 17 Mar 2017 09:00 | 1 | I resolved WA21 using this case: 1 5 1 1 2 3 4 Correct Answer => 1 the problem with my solution was initialisation of the slope in case the first 2 elements are equal. |
|
|