| Show all threads Hide all threads Show all messages Hide all messages |
| One of the correct sorting function | vectorlmn | 1745. Yet Another Answer | 31 Mar 2025 12:30 | 1 |
Becuase of edge cases,this problem take me many hours. So I put one correct sorting function here. struct ND{// Single bracket sequence int len,mn=0; int cnt=0; int id; // len is the length of the bracket sequence // if we define '(' as +1,and ')' as -1,the minimum prefix sum of the bracket sequence is mn. // and the total sum of the sequence is cnt // id is the index of the bracket sequence in the given input. }nd[maxn]; bool swap(ND& a,ND& b){ if(a.cnt>=0&&b.cnt<0)return 1;// a first if(a.cnt<0&&b.cnt>=0)return 0;// b first if(a.cnt>=0)return -a.mn<-b.mn; return -b.mn+b.cnt<-a.mn+a.cnt; } |
| some tests | 💮meanlessnessener`~ | 2171. Two Progressions 2 | 28 Mar 2025 20:11 | 3 |
631 8 902 694 854 198 479 378 808 647 53 134 77 91 493 13 597 802 ans: 22 86 15 27 93 95 30 85 88 26 17 78 66 49 60 52 21 96 85 55 45 2 69 1 47 18 20 96 80 66 8 70 51 ans: 22 75 3 49 97 16 10 10 36 ans: 8 be more careful about formulas you're sitting right next to me. you could say it to me in the face... |
| Is there an O(nm) Solution for this problem? | Geekmen | 1342. Enterprise | 28 Mar 2025 17:00 | 1 |
Any solution with time complexity strictly lower than O(nmk) will be helpful. Thanks! |
| if you have WA 15 | LeTim | 2082. Poker | 26 Mar 2025 13:43 | 1 |
Players can go all in before the cards are dealt, when they bet ante and blinds. Example of such a test: 100 200 50 5 1 1 preflop 1 1000 2 125 3 225 4 1000 5 25 0 950 0 0 750 0 Answer: 1 4 calls 200 |
| easy with float128 | ~'Yamca`~ | 1766. Humpty Dumpty | 26 Mar 2025 13:08 | 1 |
|
| WA test 24.... HELP!! | vtalgo25_zakharchenko_408648 | 1604. Country of Fools | 25 Mar 2025 05:22 | 2 |
|
| What's wrong? Runtime error | gkd002 | 2066. Simple Expression | 24 Mar 2025 21:05 | 2 |
a, b, c = map(int, input().split(" ")) a = int(a) b = int(b) c = int(c) lst = [a, b, c] lst.sort() d = lst[0]-lst[1]*lst[2] e = lst[0]-lst[1]-lst[2] if d<e: min = d else: min = e print(min) You have a 3-line input,but you entered everything in one line |
| WA 5 | ~'Yamca`~ | 1849. Rabbit Hunt 2 | 24 Mar 2025 00:35 | 1 |
WA 5 ~'Yamca`~ 24 Mar 2025 00:35 this test may help you: 4 0 0 1 0 2 0 3 0 2 1 2 1 0 1 0 1 0 1 19 1 0 ans: 2 0 |
| WA 2 | ~'Yamca`~ | 1849. Rabbit Hunt 2 | 24 Mar 2025 00:33 | 1 |
WA 2 ~'Yamca`~ 24 Mar 2025 00:33 "If there are several such propositions, output the one with the maximal number." |
| WA 52 | ~'Yamca`~ | 1717. Eligibility Rules | 23 Mar 2025 21:15 | 1 |
WA 52 ~'Yamca`~ 23 Mar 2025 21:15 1500 1 1 -1000000000 1 1 -1000000000 1 1 -1000000000 1 1 -1000000000 1 1 -1000000000 1 1 -1000000000 1 1 -1000000000 1 1 -1000000000 ..... ans: 1 1 1 1 |
| WA 22 | ~'Yamca`~ | 1455. Freedom of Speech | 21 Mar 2025 23:01 | 1 |
WA 22 ~'Yamca`~ 21 Mar 2025 23:01 4 ab ba aba bab answer: ababa |
| tests generator | LeTim | 1369. Cockroach Race | 20 Mar 2025 11:52 | 1 |
Here is a simple "bad" tests generator on C++ to test your solutions (through comparing answers with brutforce solution): const double PI = 3.14159265358979323846; mt19937 rnd; struct Point { double x, y; }; double dist(const Point& a, const Point& b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } bool check(const vector<Point>& points, const Point& p) { for (const auto& p2 : points) if (dist(p, p2) < 1e-3) return 0; return 1; } pair<vector<Point>, vector<Point>> gen_bad_test(int m = 100000, int n = 10000, double R = 10000, double r = 10) { vector<Point> cockroaches, sweets; cockroaches.reserve(m); sweets.reserve(n); while (m--) { Point p; do { double a = uniform_real_distribution<double>(0, 2*PI)(rnd); p = {cos(a) * R, sin(a) * R}; } while (!check(cockroaches, p)); cockroaches.emplace_back(p); } while (n--) { Point p; do { double a = uniform_real_distribution<double>(0, 2*PI)(rnd); double d = sqrt(uniform_real_distribution<double>(0, 1)(rnd)) * r; p = {cos(a) * d, sin(a) * d}; } while (!check(cockroaches, p)); sweets.emplace_back(p); } return {cockroaches, sweets}; } This generator uniformly distributes points-cockroaches on a circle of radius R and points-sweets inside a circle of radius r. And another generator that just distributes all points within [-MAX; MAX] along both axes: pair<vector<Point>, vector<Point>> gen_rand_test(int m = 100000, int n = 10000, double MAX = 10000) { vector<Point> cockroaches, sweets; cockroaches.reserve(m); sweets.reserve(n); auto urd = uniform_real_distribution<double>(-MAX, MAX); while (m--) { Point p; do p.x = urd(rnd), p.y = urd(rnd); while (!check(cockroaches, p)); cockroaches.emplace_back(p); } while (n--) { Point p; do p.x = urd(rnd), p.y = urd(rnd); while (!check(sweets, p)); sweets.emplace_back(p); } return {cockroaches, sweets}; } I just got AC for this problem and these two generators greatly helped me debug the solution revealing bugs and precision issues |
| Wa 13 | Hououin`~`Kyouma | 2191. Piecewise Linear Functions | 19 Mar 2025 08:24 | 4 |
Wa 13 Hououin`~`Kyouma 28 Jan 2025 23:26 Is this a rounding issue in the output? Re: Wa 13 Lyashko A (TNU/CFU) 19 Mar 2025 01:24 I had WA13 when i was printing 6 digits. More digits are needed. Thank you, I have AC now. In my implementation, it took 9 digits, but you can output much more just in case. Edited by author 19.03.2025 08:24 |
| WA 3 | ~'Yamca`~ | 1951. Complex Root | 17 Mar 2025 23:33 | 1 |
WA 3 ~'Yamca`~ 17 Mar 2025 23:33 |
| WA 4 | tima20072007 | 1881. Long problem statement | 16 Mar 2025 23:00 | 2 |
WA 4 tima20072007 4 Apr 2024 21:45 Не вздумайте решать задачу, оно того не стоит. Re: WA 4 Andre Marin C# 16 Mar 2025 23:00 я именно за этим и пришел сюда |
| WA2 | andreyDagger`~ | 1882. Old Nokia | 16 Mar 2025 22:55 | 3 |
WA2 andreyDagger`~ 13 May 2023 15:27 Re: WA2 ~'Yamca`~ 16 Mar 2025 18:56 Re: WA2 andreyDagger`~ 16 Mar 2025 22:55 |
| WA 3 | ~'Yamca`~ | 1940. Not So Simple Years | 13 Mar 2025 18:10 | 1 |
WA 3 ~'Yamca`~ 13 Mar 2025 18:10 Don't forget to add primes <= k |
| cool problem, but overrated | ~'Yamca`~ | 2195. Binary Trees | 12 Mar 2025 20:16 | 1 |
|
| PLEASE_Python Time limit exceeded | Alice | 1196. History Exam | 11 Mar 2025 17:31 | 1 |
how can it be improved???? n = int(input()) sp = [] a = [] c = 0 for i in range(n): sp.append(int(input())) m = int(input()) for i in range(m): x = int(input()) if x in sp: c += 1 print(c) |
| if a = 0 and b = 0?? | gooooooogol | 1420. Integer-Valued Complex Division | 11 Mar 2025 10:55 | 2 |
if a = 0 and b = 0 => r = 0 and q every complex number => count solation equation = infinity |