| Show all threads Hide all threads Show all messages Hide all messages |
| Те у кого wa2, 6, 22 и тд | Toshpulatov (MSU Tashkent) | 1334. Checkers | 11 Apr 2020 16:04 | 1 |
Не слушайте тех кто пишет что убрал проверку за границы и зашла и все в таком духе. Возможно у вас такая же ошибка как и у меня, а то есть когда ввели новые координаты я проверял только то что может ли эту новую координату кто то ударить, а надо было еще проверить что может ли новая координа ударить кого то из врагов |
| To Admins / My solution need to be rejudged ) | Laise | 1112. Cover | 10 Apr 2020 16:16 | 8 |
I use some shamanism ang get AC. Lets see to the next test: 6 0 20 10 50 30 100 60 120 70 130 110 140 my AC prog outputs: 2 10 50 110 140 but right answer of course is: 3 0 20 30 100 110 140 Your tests must be stronger Your test is added. Problem will be rejudged soon. test 6 0 -20 -10 -50 -30 -100 -60 -120 -70 -130 -110 -140 my AC solution have answer 2 -140 -110 -50 -10 on this test, so you've fucked up twice You have fucked up three times with wrong test my answer is : 10 50 60 120 70 130 this problem is quite easy but output is difficult to suitable to right answer !!!!! perhaps i get WA because of it Edited by author 15.03.2009 12:34 Thanks For the test~ I wa#12 and the test helped me. Edited by author 26.11.2009 08:19 |
| В условии неверно описан формат тестов | yz | 1003. Parity | 10 Apr 2020 14:24 | 2 |
Извините, что по-русски, надеюсь, администраторы знают этот язык. В условии сказано, что длина последовательности задается в первой строке каждого теста. В примерах на форуме длина общая для всех, в каждом тесте задается только количество вопросов. Моя AC-программа действует по форуму: читает длину один раз, а потом только количество вопросов для каждого теста. Хорошо бы привести текст задачи в соответствие с реальностью. Совсем хорошо было бы дать в примере два теста, чтобы сделать структуру входных данных действительно ясной. |
| Stuck on Test 6? Read Here! | Davanish | 1654. Cipher Message | 8 Apr 2020 23:22 | 6 |
For Time limit exceeded: If you get time limit exceeded, it must mean that you're trying to modify the input string (i.e. trying to delete i-th chars). Try creating a new OUTPUT string without modifying the INPUT string. Note: if you're using a high language such as java or C#, try using the StringBuilder object to build your output string. For Wrong Answer(WA): If you get WA, try some of these test cases: Input: "dddd" Output: "" Input: "ddddd" Output: "d" Input: "abba" Output: "" Input: "abbbbac" Output: "c" Input: "wliisddsmmleeddw" Output: "" Input: "avcbbffcv" Output: "a" Hope this helps. Edited by author 12.07.2012 00:47 Input: "abbbbac" Output: "c" Спасибо, помогло! For Time limit exceeded: If you get time limit exceeded, it must mean that you're trying to modify the input string (i.e. trying to delete i-th chars). Try creating a new OUTPUT string without modifying the INPUT string. Note: if you're using a high language such as java or C#, try using the StringBuilder object to build your output string. For Wrong Answer(WA): If you get WA, try some of these test cases: Input: "dddd" Output: "" Input: "ddddd" Output: "d" Input: "abba" Output: "" Input: "abbbbac" Output: "c" Input: "wliisddsmmleeddw" Output: "" Input: "avcbbffcv" Output: "a" Hope this helps. Edited by author 12.07.2012 00:47 Thanks a lot...I could'n understand the problem statement first, now, reading ur comment I clearly understood the problem. for me problem was that program was returning "axx" on "aaaxx" Edited by author 18.03.2017 19:56 |
| Why is it showing wrong answer? I have given a lot of input. In my pc this program is showing correct answer all the time. | mars | 1787. Turn for MEGA | 6 Apr 2020 22:32 | 1 |
#include<iostream> using namespace std; int main(){ int k, n, arr[101],x=0; cin>>k>>n;
for(int i=0; i<n; i++){ cin>> arr[i];
} for(int i=0;i<n;i++){ if(k>=arr[i]){ if(i != n-1){ x = x + arr[i+1]; arr[i+1] = x;
x = 0;
} else{ x = 0; }
} else{ if(i != n-1){ x = (arr[i]-k) + arr[i+1]; arr[i+1] = x;
} else{ x = arr[i] - k; } } // printf("X : %d\n",x); } if(x<=0) cout<<0; else cout<<x;
} |
| No subject | D4nick | 1146. Maximum Sum | 6 Apr 2020 16:04 | 1 |
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector <vector <int>> a(n, vector <int> (n)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; } } int ans = a[0][0]; for (int leng = 1; leng <= n; leng++){ for (int up = 0; up <= n-leng; up++){ vector <long long> sumv(n); for (int j = 0; j < n; j++) { for (int i = up; i < up + leng; i++) { sumv[j] += a[i][j]; } } int sum = 0; for (int r = 0; r < n; ++r) { sum += sumv[r]; ans = max(ans, sum); sum = max(sum, 0); } } } cout << ans; } |
| WA8 but passes ALL tests in discussion | Ulugbek#& | 1354. Palindrome. Again Palindrome | 6 Apr 2020 13:16 | 2 |
has anybody got WA8 too? I tried all tests in forum but it didn't help :( Be careful when you implement Manacher's algorithm, when you copy the ready part for the second part, don't forget making all the needed changes, I forgot changing just one sign ! |
| No subject | D4nick | 1226. esreveR redrO | 6 Apr 2020 04:43 | 1 |
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string c = "a"; string word; for (;;) { c = getc(stdin); if (c[0] == EOF) { reverse(word.begin(), word.end()); cout << word; break; } if (((c[0] >= 'a') && (c[0] <= 'z')) || ((c[0] >= 'A') && (c[0] <= 'Z'))) { word.append(c); } else { reverse(word.begin(), word.end()); cout << word << c; word.clear(); } } } |
| #Test_13 | Nobodyquennteam | 1471. Distance in the Tree | 4 Apr 2020 14:52 | 1 |
#Test_13 Nobodyquennteam 4 Apr 2020 14:52 |
| IF you have TL and use sqrt + map | Toshpulatov (MSU Tashkent) | 1846. GCD 2010 | 3 Apr 2020 00:21 | 1 |
instead map use unordered_map |
| do you know what test 12 is? | STAVASD | 1354. Palindrome. Again Palindrome | 1 Apr 2020 19:22 | 4 |
once I've solved this exercise, but know a vontto make my algorithm better. I've forced whith WA#12. Could you tell me this test? I've solved it!!))) if you have the same problem, try test: 1233345333 ansver: 12333453335433321 |
| No subject | D4nick | 1086. Cryptography | 1 Apr 2020 11:20 | 1 |
#include <iostream> #include <vector> #include <iterator> using namespace std; int n = 163841; vector<char> prime(n + 1, true); void eratosphen() { prime[0] = false; prime[1] = false; for (int i1 = 2; i1 <= n; ++i1) if (prime[i1]) if (i1 * 1ll * i1 <= n) for (int j1 = i1 * i1; j1 <= n; j1 += i1) prime[j1] = false; } int main() { eratosphen(); vector <long long> list(15001); int i = 2; for (int il = 1; il <= 15000;) { for (int ip = 2; ip < prime.size(); ip++) { if (prime[ip]) { list[il] = ip; il++; } } } int k; cin >> k; for (int i0 = 0; i0 < k; i0++){ int m; cin >> m; cout << list[m] << '\n'; \ } } |
| If you have WA 7 | Toshpulatov (MSU Tashkent) | 1628. White Streaks | 31 Mar 2020 16:40 | 1 |
|
| An O(K^2) solution | CmYkRgB123 | 1119. Metro | 30 Mar 2020 23:12 | 3 |
Sort the quarters that can be crossed.And then dp. The state transition equation is F[i]=Max{ F[j] + 1 | P[j].x<P[i].x and P[j].y<P[i].y } The maximum of F[i] is the number of the the quarters that should be crossed. Then you can work out the answer. Edited by moderator 18.08.2020 02:22 A solution for Chinese readers.Much clearer. 这道题有明显的动态规划策略。首先不要按照方格来考虑,考虑顶点,这样目标点就是(N+1,M+1)。 ---------算法1----------- 最直观的想法是按照矩阵动态规划。 设状态F[i,j]为走到点(i,j)时的最短路径 状态转移方程 F[i,j]=Min { F[i-1,j]+100 F[i,j-1]+100 F[i-1,j-1]+141.4213562373 } 边界条件 F[0,0]=0 F[N+1,M+1]就是结果。 但是对于8M的内存限制,要使用滚动数组。 时间复杂度为O(N*M) ---------算法2----------- 可以发现,如果我们只走直边的话,要走(N+M)*100长度。如果走C条斜边,那么要走(C*141.4213562373)+(N+M-C*2)*100 的长度。那么显然我们要尽可能使C更大,即多走斜边。 这样可以转化为经典的LIS模型。即把所有的斜边按照坐标排序,然后求最长的上升序列(x,y都要严格递增),走这样的斜边一定是最优的策略。于是我们可以求出C。 结果就是(C*141.4213562373)+(N+M-C*2)*100。 Vijos 1336其实就是这道题的数据加大版。对于较小的K和很大的N,M,只能用算法2解决。 by translating............. A solution for Chinese readers.Much clearer. This problem has obvious dynamic programming strategies. First, don't think in terms of squares, consider vertices, so the target point is (N + 1, M + 1). --------- Algorithm 1 ----------- The most intuitive idea is dynamic programming in terms of matrices. Let the state F [i, j] be the shortest path to the point (i, j) State transition equation F [i, j] = Min { F [i-1, j] +100 F [i, j-1] +100 F [i-1, j-1] +141.4213562373 } Boundary condition F [0,0] = 0 F [N + 1, M + 1] is the result. But for the 8M memory limit, a rolling array is used. Time complexity is O (N * M) --------- Algorithm 2 ----------- It can be found that if we only go straight, we have to go to (N + M) * 100 length. If you take the C hypotenuse, then you have to take the length of (C * 141.4213562373) + (N + M-C * 2) * 100. So obviously we want to make C as large as possible, that is, take more hypotenuse. This can be transformed into a classic LIS model. That is, sort all the hypotenuses according to the coordinates, and then find the longest ascending sequence (x, y must be strictly increased). Taking such hypotenuses must be the optimal strategy. Then we can find C. The result is (C * 141.4213562373) + (N + M-C * 2) * 100. Vijos 1336 is actually an enlarged version of this question. For smaller K and large N, M, it can only be solved by algorithm 2. |
| How could we solve this problem by DP? | HowieMa | 1073. Square Country | 29 Mar 2020 14:23 | 3 |
We could solve it by Theorem on the sum of four squares, I wonder how to solve it by DP? If you know, please help me, thank you! We could solve it by Theorem on the sum of four squares, I wonder how to solve it by DP? If you know, please help me, thank you! Well... For n=72... what are the possible squares you can take? You can take 64,49,36,25...4,1 . So what's the best result for 72? The best result Best(72)=min(Best(72-64),Best(72-49),Best(72-36), ... Best(72-1))+1; Now whats the base cases? U see, for all square numbers, u can take it in one go. So Best(1)=Best(4)=Best(9)=Best(16) ... = 1 Its a top down approach. I hope u got the idea... Goodluck. Btw, I'm wondering how u solved by Theorem on the sum of four squares. Can u send your code to my mail please? ealham86@gmail.com i solved it with dp. but i wondered with u.plz send me ur code. EMAIL:achowdhury@isrt.ac.bd |
| Give 13 test please | vtalgo20_egurin | 1628. White Streaks | 29 Mar 2020 01:52 | 1 |
I failed on 13 test and I can't found error. Please give a 13 test. |
| Agree? Found out the game? | Kirom `Ekexity [SESC17]💻 | 2148. Insane Shot | 28 Mar 2020 14:47 | 2 |
|
| WA on TEST 20 | Ashiqur Rahman Nayeem | 1684. Jack's Last Word | 28 Mar 2020 04:35 | 2 |
|
| WA 44 | СуБаЕг | 2112. Battle log | 28 Mar 2020 02:26 | 2 |
WA 44 СуБаЕг 19 Nov 2019 23:09 Edited by author 19.11.2019 23:33 Edited by author 19.11.2019 23:44 |
| Math explanation | mberdyshev | 1214. Strange Procedure | 27 Mar 2020 22:02 | 2 |
We are given positive x and y. Let's go in the first loop. Let's do some method refactoring for better understanding: y0 = x*x+y; x0 = x*x+y0; y1 = sqrt(x0+(y0/labs(y0))*(-labs(y0))); for (j = 1; j <= 2*y1; j++) x0 = x0-y1; x = x0; y = y1; Let's go through the lines: y0 = x*x + y Next: x0 = x*x + y0 = 2*x*x + y As y0 > 0 (x, y are positive) => y0/labs(y0) = 1 So y1 = sqrt(x0+(y0/labs(y0))*(-labs(y0))) = sqrt(x0-labs(y0)) = sqrt(2*x*x + y - (x*x + y)) = sqrt(x*x) = x Next 2 lines equals to this: x0 = x0 - 2*y1*y1 = 2*x*x + y - 2*x*x = y So, x=y and y=x. x and y are swapped. After that you need to count amount of swaps and print appropriate answer |