| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| TLE is a problem | goodcoffee | 1198. Коррупция | 26 апр 2023 04:50 | 1 |
but Kosaraju + scanf + MS compiler may help here |
| Some tests | SKYDOS | 1083. Факториалы!!! | 24 апр 2023 18:54 | 7 |
1) 11 !!!! - 231 2) 13 !! - 135135 3) 36 !!!!!! - 33592320 4) 7 !!!!! - 14 5) 21 !!!!!!! - 2058 and DONT forget that (n mod k) or k is not the last multiplayer rus: не путайте, (n mod k) или k не являются последним множителем!! "не путайте, (n mod k) или k не являются последним множителем!!" Серьзно? Условие максимально тупо написано... |
| WA 20 (new test) | LLI_E_P_JI_O_K | 1041. Никифор | 23 апр 2023 23:39 | 2 |
If you got problems with WA 20 (new test), just know - it is because of precision issue. Not use double or long double - only long integer arithmetic or integer modular arithmetic. P.S. authors of new tests - it is not good to add tests to the OLD task after 23 years of time passed. It is so strange. Why authors of solutions must return to the OLD task and resolve it again??????? Thanks LLI! By the way, I used integer modular arithmetic in the first place, and still got WA 20 after rejudge. After some debugging I realize I checked the linear independency incorrectly (in particular, I did the row echelon form wrongly). Here is the test case helped me find out the bug: Input: 5 4 1 2 3 4 2 4 5 9 3 6 7 1 1 1 1 9 3 2 1 9 1 2 3 4 5 Expected output: 10 1 2 3 4 |
| New tests added | Merkurev Oleg [Dandelion] | 1041. Никифор | 23 апр 2023 15:10 | 3 |
New tests were added. All accepted solutions were rejudged, ~60% of them lost their Accepted status. When will new contests be added as well? If you got problems with WA 20 (new test), just know - it is because of precision issue. Not use double or long double - only long integer arithmetic or integer modular arithmetic. |
| WA5 Test | vtalgo23_Erbaev_336183 | 1160. Network | 22 апр 2023 14:15 | 1 |
WA5 Test vtalgo23_Erbaev_336183 22 апр 2023 14:15 So I was checking if the 2 vertices of the graph already connected, but didn't consider the test below and wasted a lot of time looking for a mistake and rewriting the code 4 3 1 2 1 3 4 2 2 3 3 Correct output: 3 3 1 2 3 4 2 3 My output: 2 2 1 2 3 4 |
| For WA#50 | Pat | 2102. Миша и криптография | 22 апр 2023 12:38 | 1 |
Check 524288, should be NO. Test other cases where you have 19 factors, and the last one remaining is 1. |
| Hint for WA1 | Ade | 1307. Архиватор | 22 апр 2023 09:08 | 1 |
Try your generated //CPP code with MSVC to check if there's any compile error. If you don't have MSVC installed, just submit the *generated* code. |
| How I have beaten Runtime Error on python and got AC | Maxim Rodionov | 1030. Титаник | 20 апр 2023 21:49 | 1 |
You have to make one more "if" ###################################################################################### d = math.sin(p1) * math.sin(p2) + math.cos(p1) * math.cos(p2) * math.cos(abs(l1 - l2)) if str(d) == '-1.0000000000000002': d = int(d) d = math.acos(d) * 3437.5 ###################################################################################### there is a test where '-1.0000000000000002' in d so thats why acos gives error, you have to change '-1.0000000000000002' to -1 Edited by author 20.04.2023 21:49 Edited by author 20.04.2023 21:49 |
| What is the wrong in this code?? | SHANTO ISLAM | 1100. Таблица результатов | 20 апр 2023 16:07 | 2 |
//URAL-1100-FINAL STANDINGS //--------------------------------- #include<bits/stdc++.h> using namespace std; #define endl '\n' bool comp(pair<int,int>a,pair<int,int>b) { return a.second>b.second; } void sortt(map<int,int>mp) { vector<pair<int,int>>v; for(auto it:mp) { v.push_back(it); }
stable_sort(v.begin(),v.end(),comp); for(auto it:v) { cout<<it.first<<" "<<it.second<<endl; } } int main() { map<int,int>mp; int n; cin>>n; for(int i=0; i<n; i++) { int x,y; cin>>x>>y; mp[x]=y; } sortt(mp); return 0; } You are expecting the map to preserve the order. It does not - it sorts by key. Try using unordered_map<int, int> mp |
| A question | bsu.mmf.team | 1782. Новое слово Джека | 18 апр 2023 23:20 | 3 |
In my AC solution I didn't use the fact that "there is no substrings in the form xyxyx" anywhere. My program even assumes the answer in this problem can be "-1", but I guess there are no such testcases in this problem because of this advanced condition. So, could anybody tell me how this fact helps to simplify the solution? Or, maybe, anybody can prove or deny my hypotesis about "-1"? Thanks in advance! Well, I must admit the fact, that I didn't even notice this strange condition when I was trying to solve this problem, and now, I have passed all tests with simply using Depth First Search. In fact, if this condition holds, let x be 0 or 1 and let y be a null string, so there could not exist a substring with 3 consequent, and same characters. This could do good to the simplification of saying the word. So I guess that, when using this condition, we could not generate any "No solution" cases, so that solutions should exist. So, when using DFS, one could find some acceptable construction of the word easily. Yeah... I also don't understand a couple thing of the statement: Why they are restricting the answer to only 100 moves. Why they aren't asking the minimum number of operations. And finally, why there's the xyxyx restriction. I managed to find the minimum number of operations in O(N log N), so really, the statement just doesn't make any sense to me... I enjoyed the problem though |
| I solved 200 problems for 155 days | Hristo Nikolaev (B&W) | | 18 апр 2023 18:13 | 1 |
I have always been interested in applied programming (since 9th grade), but less than an year ago I discovered a great hobby - solving competitive programming problems. After the 200th AC, I would say This Online Judge is great, and I wish everyone motivation and good luck! |
| AC with this formula | Sergey | 1081. Двоичная последовательность | 18 апр 2023 17:54 | 6 |
I've used this formula to solve this problem: a(n) = 2^(b(n)-1) + a(n - c(1+b(n))) b(n) = -1+floor(log(((n+0.2)*sqrt(5)))/log((1+sqrt(5))/2)); c(0) = 0, c(1) = 1, c(n) = c(n-1) + c(n-2) I don't want to live in this world anymore. wow!!!! you probably made an easy thing too complicated. Looks like you're using golden ratio to calculate Fibonacci Way too complicated. I solved entirely using bitwise operations and an array with the first 64 Fibonacci numbers. |
| too easy for 175 | Arseniy | 1727. Магические числа Знайки | 17 апр 2023 23:04 | 2 |
Why this problem has 175 difficulty? I thought it has very hard to implement solution, but to sovle it you should do what exactly said in staitment... It's harder if you have to do it with a minimum number of items in the generating set, but with this statement - I got a very fast AC with random number generation. |
| Problem 1163. Chapaev rejudged | Vladimir Yakovlev (USU) | 1163. Chapaev | 17 апр 2023 16:25 | 1 |
New tricky tests have been added to the problem. All solutions have been rejudged. 152 authors (62% of all) lost their solved status for the problem. |
| Не понимаю в чем проблема. Пишет Runtime Error | Roman | 2100. Свадебный обед | 14 апр 2023 21:34 | 1 |
import java.util.Scanner; public class Task_2100 { public static void main(String[] args){ Scanner scr1 = new Scanner(System.in); Scanner scr2 = new Scanner(System.in); int n, counter; n = scr1.nextInt(); counter = n+2; while(n-- > 0){ String guest = scr2.nextLine(); String substring = "+"; if(guest.contains(substring)){ counter++; } } if(counter==13) { counter++; } System.out.print(counter*100); } } |
| If you sort segments according to INCREASING length | Mahilewets | 1987. Вложенные отрезки | 13 апр 2023 23:54 | 2 |
If you sort segments according to INCREASING length. Then you can consider all segments one by one consecutively. Find points belong to the current segment. For those points current segment is the answer. Because of the segments are sorted. From all suggested hints, this is the fastest way to do it. Initially I tried with trees, but I was getting TLE on #13. Finally I decided to use a map for the points (with key=point, value=index) It's a very convenient Data Structure, because it provides fast search for the nearest value (lower bound), and allows you to delete that point once its segment has been found. I tried without deleting it, but got TLE #14. Deleting each point from the map after finding it makes the map smaller after each iteration. Finally got an AC in 0.1 |
| Solution using Z-function is O(n) but gives TLA | Anton | 1423. Басня о строке | 13 апр 2023 23:25 | 1 |
Unexpected result: the solution using z-function is O(n) but gives TLA on the 8th test. The solution doesn't pass so I will leave the code with it here. I'm wondering if it really doesn't pass the 8th test because it is too slow though is O(n), or if there's just some kind of error in my algorithm. vi ZFunction(string &p, string &s) { int n = (int) p.size(); vector<int> z(n + 1); for (int i = 0, l = 0, r = 0; i < n; ++i) { if (i <= r) z[i] = min(r - i + 1, z[i - l]); while (i + z[i] < n && p[z[i]] == s[i + z[i]]) ++z[i]; if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1; } return z; } .... vector<int> z_func = ZFunction(s1, s2); vector<int> z_func2 = ZFunction(s2, s1); for (int i = 0; i < n; ++i) { if (z_func[i] == n - i && z_func2[n - i] == i) { cout << i; return; } } cout << "-1"; Edited by author 13.04.2023 23:25 Edited by author 13.04.2023 23:25 Edited by author 13.04.2023 23:27 |
| WA26 | andreyDagger`~ | 2041. Наноматрёшки | 13 апр 2023 00:32 | 1 |
WA26 andreyDagger`~ 13 апр 2023 00:32 Check your "MAXN" constant |
| Any hint for WA29 | Hristo Nikolaev (B&W) | 1846. НОД 2010 | 12 апр 2023 23:27 | 1 |
I`m using vector of segments. Everything is pretty fast, All the tests I could think of work correctly. EDIT: Finally, got a pretty good AC - Time: 0.234, Memory: 5 032 KB. (The problem was that I was not monitoring for segments getting empty) Edited by author 12.04.2023 23:40 |
| Who can give me test #5 ??? | Truong Thanh Tung | 1101. Робот в поле | 12 апр 2023 21:26 | 4 |
|