| Show all threads Hide all threads Show all messages Hide all messages |
| what's wrong??? C++ | inctnce | 1787. Turn for MEGA | 5 Sep 2019 23:55 | 1 |
#include <iostream> using namespace std; int main() {
int n, k; cin >> n >> k; int c = n * k; int *arr = new int[k];
for (int i = 0; i < k; i++) { cin >> arr[i]; c = c - arr[i]; }
cout << abs(c);
} |
| WA 4 | M@STeR.SoBG | 1303. Minimal Coverage | 5 Sep 2019 14:45 | 9 |
WA 4 M@STeR.SoBG 15 Apr 2008 14:24 Could anybody help me? I have WA at 4th test! Re: WA 4 Vladimir Plyashkun [CSU] 3 May 2012 00:53 u may try this test: 2 1 2 0 1 0 0 so output should be: 2 0 1 1 2 when WA is 2 1 2 0 1 Re: WA 4 Smilodon_am [Obninsk INPE] 18 Sep 2012 21:54 This test helped me: 4 0 4 -5 0 3 4 -4 4 0 0 Answer is: 1 -4 4 Is the answer : 1 0 4 right? i have wa 4 too,and i am confused about the output principles. Re: WA 4 Marin Shalamanov 30 Jan 2013 21:37 This test helped me: 10 -5 1 1 14 -5 2 2 3 3 19 0 0 The answer is: 2 -5 1 1 14 Now, let's fight with WA5 :D why not this: 2 -5 2 1 14 ? Actually, what if there are several possibilites to cover? I think that it does not matter which one you choose, as long as it has a minimum number of intervals. I guess the judge just tests whether the intervals you give cover the large interval. Best regards, Erik Edited by author 25.02.2013 04:56 This test helped me too. At last got AC. My solution is similar to task 1987. Edited by author 05.09.2019 16:47 |
| Proof of the result? (+) | Vedernikoff Sergey (HSE: АОП) | 1714. Mnemonics and Palindromes 2 | 5 Sep 2019 04:11 | 2 |
Ok, I've found relation between n and maximin palindrome number and several optimal patterns that depend on n mod 12. Only one question has left: how to prove all this stuff? My AC solution is using n mod 6 to determine the optimal solution. The proof is rather complicated and heavily relies on some particular pattern of length 6. Apart from that, it's just analysing lots and lots of cases. |
| Cameras on starting and finish line | espr1t | 1990. Podracing | 5 Sep 2019 01:27 | 2 |
How to treat cameras, located on the starting and/or finish line? Do racers interact with them? My AC solution treats those cameras as if they interact with the racers. |
| Hint For Test Case# 16 | Yuv | 1423. String Tale | 4 Sep 2019 10:49 | 2 |
Cannot break this case. Any hint? Ok I don't know what was the case# 16. But I have found some test cases: 9 abghxrfab rfabghxrf ans: -1 9 abghxabab ababghxab ans: 2 12 abcghxabcabc cabcghxabcab ans: 1 |
| Algo. Hints. | IgorKoval(from Pskov) | 1894. Non-Flying Weather | 3 Sep 2019 16:47 | 4 |
What is algorithm? What formulas, theorems, equations and hints must I use? Thx Really, if we can find A-B then we must understand that [0,0] belong to A-B or not If 'yes' then answer = max{0, dist([0,0], A-B) - 60} If 'no' then answer = 0 |
| Getting wrong answer for test case #3 | Aakanksha Sharma | 1146. Maximum Sum | 3 Sep 2019 16:44 | 1 |
My code is as following: #include<iostream> #include<vector> using namespace std; long getMaxSumRow(long rowArr[], int n) { long cs = 0; long ms = 0; bool positiveNumberPresent = false; for (int i = 0; i < n; i++) { if (!positiveNumberPresent && (rowArr[i] >= 0)) { positiveNumberPresent = true; } cs += rowArr[i]; if (cs < 0) { cs = 0; continue; } if (cs > ms) { ms = cs; } } if (positiveNumberPresent) { return ms; } ms = rowArr[0]; for (int i = 0; i < n; i++) { if (rowArr[i] > ms) { ms = rowArr[i]; } } return ms; } long maxSumRec(vector<vector<long> > &arr, int n) { if (n == 1) { return arr[0][0]; } /* Take an array for running rows sum */ long runningRowSum[n]; for (int r = 0; r < n; r++) { runningRowSum[r] = 0; } long maxSum = INT_MIN; /* Initialize variables for left-right and top-bottom bounds */ int left, right, top = 0, bottom = n-1; /* Iterate from all possible lefts to all possibe rights ahead of this left */ for (left = 0; left < n; left++) { for (right = 0; right < n; right++) { for (top = 0; top <= bottom; top++) { runningRowSum[top] += arr[top][right]; } /* For this left-right combination, calculate contigeous subarray with maximum sum in runningRowSum */ long currSum = getMaxSumRow(runningRowSum, n); if (currSum > maxSum) { maxSum = currSum; } } /* Reinitialize running row sum to 0 */ for (int r = 0; r < n; r++) { runningRowSum[r] = 0; } } return maxSum; } int main() { int n; cin >> n; vector<vector<long> > arr(n); for (int i = 0; i < n; i++) { arr[i] = vector<long>(n); for (int j = 0; j < n; j++) { cin >> arr[i][j]; } } cout << maxSumRec(arr, n); return 0; } But I am getting wrong answer for test case#3 . Any advice on what it might be failing at ? |
| TEST | buyolitsez | 1156. Two Rounds | 3 Sep 2019 09:22 | 1 |
TEST buyolitsez 3 Sep 2019 09:22 3 4 1 2 1 3 4 5 4 6 ans: 1 5 6 2 3 4 Edited by author 03.09.2019 09:23 |
| no impossible case | sonamon | 1106. Two Teams | 28 Aug 2019 23:42 | 2 |
There cannot be any impossible case as is suggested by the very first line of the problem statement yes , no impossible cases are present. |
| The main task is 10^250 | Михаил | 1180. Stone Game | 26 Aug 2019 16:18 | 1 |
|
| Can anyone translate the statement? | PrankMaN | 1053. Pinocchio | 25 Aug 2019 00:22 | 2 |
My Endlish is not that good, could anyone translate it into Russian, pls? Так с гугл-переводчиком понятно |
| WA3 | dickbooster | 1881. Long problem statement | 24 Aug 2019 22:56 | 11 |
WA3 dickbooster 22 Oct 2011 15:17 inputs of the third test? Re: WA3 dickbooster 22 Oct 2011 15:38 try this: 3 5 9 aa aa aaa aa aa aa aaa aa aaa i have passed the test you give, but i still got WA3....help //i found a silly mistake and now passed test3... but still WA for the next Edited by author 26.03.2012 11:13 Edited by author 26.03.2012 11:14 //i found a mistake again.....and then i got AC Edited by author 26.03.2012 11:20 Re: WA3 ramon93i7 16 Apr 2012 12:30 What was your second mistake? answer: 3 для первого теста для второго 2 Edited by author 21.10.2012 12:43 You can try this test case: 3 2 6 aa a a aa aa a Correct answer: 2 Isn't corect answer 6? aa a a (not a a = 3 symbols) aa aa a Re: WA3 RandyWaterhouse 15 Jun 2019 10:41 Deleted Edited by author 24.08.2019 23:00 Re: WA3 Chuk.Charles 25 Sep 2015 16:24 Try this test: 1 5 2 to be answer: 1 Edited by author 25.09.2015 16:26 |
| Some helpful test !!!!!!!!!! | Noname | 1406. Next Number | 24 Aug 2019 12:19 | 10 |
Try this test inp 901000 ans 910000 And this input: 091 output: 109 and 092 119 0920 1019 Edited by author 22.12.2006 19:08 My program "give AC" on your tests, but give WA#19. Somebody, give me more tests please. Try this 39910000 -> 40000099 99 -> -1 00 -> -1 1 -> -1 011 -> 020 Good Luck!) Edited by author 06.06.2009 23:08 Edited by author 06.06.2009 23:08 Try this and look for the time 010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Should give 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Edited by author 18.07.2007 05:06 My program give AC on your tests, but give WA#4. Please give me tests #4 or more tests. Thank. Test 59 look like: 1000000000000000000000000 Answer: -1 |
| WA5, any tests? | motoras | 1050. Preparing an Article | 23 Aug 2019 04:47 | 2 |
I run out of ideas, trying to pass test #5. Does anyone can tell me how this test looks like? Thank you, There seem to be some non-ASCII characters in the test cases. If the input is loaded byte by byte, then the result should be output byte by byte as well. I used Rust and handled the bytes as chars, which were stored as 4-byte unicode, but mistakenly output the result by chars instead of bytes. |
| Tests | Vlasov_Sergey | 1955. Boss, I Can See You! | 22 Aug 2019 12:38 | 1 |
Tests Vlasov_Sergey 22 Aug 2019 12:38 Good test: 16 0 0 3 0 3 1 4 1 4 0 7 0 7 2 6 2 6 1 5 1 5 2 2 2 2 1 1 1 1 2 0 2 My AC program prints 7.000000 Another test: 13 1 1 3 1 3 3 5 3 5 5 3 5 4 4 2 4 2 2 1 3 0 3 0 0 1 0 Answer: 7.071068 If your program has O(n^2*log(n)) time complexity or faster try the following tests: 10 4 10 0 0 5 0 5 3 13 3 10 8 5 8 7 5 2 1 5 10 Answer: 12.276044 24 13 10 11 17 7 20 1 20 1 11 13 0 23 7 23 19 14 22 20 18 18 11 13 6 5 15 13 4 20 8 13 3 8 7 3 14 3 17 6 17 13 8 17 17 11 20 14 17 Answer: 20.645581 29 17 13 11 12 10 10 12 6 22 6 23 13 12 18 0 14 12 1 14 2 7 12 12 15 20 13 18 10 12 10 19 8 21 13 12 16 5 13 12 3 2 14 12 17 22 13 21 7 12 7 11 10 19 13 13 14 10 13 Answer: 18.193976 Edited by author 25.08.2019 17:28 |
| Is it really needed? | maslowmw | 1249. Ancient Necropolis | 21 Aug 2019 18:33 | 1 |
Is it really needed to set 4mb memory limit? I really must to remember pascal for this task, because the same solution have TL (not a Scanner) or ML on java. May be it's possible to up memory limit to 8mb? |
| Why i am getting WA at test 1 | Tazma | 1209. 1, 10, 100, 1000... | 21 Aug 2019 01:36 | 1 |
#include<bits/stdc++.h> using namespace std; const long long size=65535; long long ara[size]; long long b[size]; Find() { long long i, sum=1, j; for(i=0, j=1; i<=size; i++, j++) { sum=sum+i; ara[j]=sum; } } int main() { long long i, n, a, r, j; Find(); cin>>a; for(i=1; i<=a; i++) { cin>>b[i]; } for(i=1; i<=a; i++) { r=0; for(j=1; j<=size; j++) { if(b[i]==ara[j]) { r=1; break; } } if(r==1) { printf("1 "); } else { printf("0 "); } } printf("\n"); return 0; } |
| wrong ans in case #3 | Mushfiq Talha | 1209. 1, 10, 100, 1000... | 20 Aug 2019 21:12 | 6 |
Code removed Edited by author 20.08.2019 21:12 8*n-7 <--- integer overflow Integer overflow. But why? And How? Edited by author 17.08.2019 19:12 [code deleted] This code gets wrong answer in case #3. Edited by author 18.08.2019 20:49 Edited by author 18.08.2019 20:49 Edited by moderator 17.11.2019 18:48 On timus 'long int' is equal to 'int', to use 64-bit integers you need to write 'long long'. Also, there is a precision error in your 'per_sq' function. This line: return ((x-floor(x))?0:1); must be written as return (abs(x-floor(x)) > 1e-8 ? 0 : 1); Thanks. I didn't know about the bit size of long in Timus. And what you said about the function. I had problem in the argument. I used double instead of int then it got accepted. |
| Is it possible to solve the problem with Python? | Edmonton | 1146. Maximum Sum | 20 Aug 2019 00:25 | 1 |
I can't understand how to solve the problem with Python and meet time limitations. I implemented solution with creating 3-D list of subsumes[column][row_start][row_offset] using accumulate from itertools and list comprehension. After that I used Kadane's algorithm. I expect that it works with O(N^3). But it isn't enough... Are there some tricks in the problem for Python? Except for stdin of course. |
| AC on python 3.6 | ivan pasechnik`~ | 2025. Line Fighting | 19 Aug 2019 22:05 | 2 |
t = int(input()) for i in range(t): m = [] kv = 0 n,k = map(int,input().split()) ok =k for i in range (k): if i == 0: m.append(n//ok) kv += m[i] n-=n//ok ok-=1 else: if i == k-1: m.append(n) else: m.append(n//ok) kv+=m[i] n-=n//ok ok-=1 otr,ans = 0,0 l,l1 = 0,0 m.sort() m.reverse() ss = sum(m) for i in range(k-1): l += m[i] l1 = m[i] ans += (ss-l)*l1 print(ans) t = int(input()) for i in range(t): n, k = [int(i) for i in input().split()] m = n // k q = n % k s = (m * (n - m) * (k - q) + (m + 1) * (n - m - 1) * q) // 2 print(s) #распределяем максимально равномерно и "деремся" команда из m против всех оставшихся + команда из m + 1 против всех оставшихся и, поскольку учли каждый бой по два раза (для обоих участников), делим пополам =) |