| Show all threads Hide all threads Show all messages Hide all messages |
| some tests | LeTim | 1859. Last Season of Team.GOV | 7 Apr 2025 18:01 | 1 |
Input: 4 000000001111111111111111 8 4 5 6 7 8 15 16 17 17 18 19 20 21 22 23 24 Example output: 1 2 9 10 11 12 3 8 15 16 17 18 4 5 13 14 19 20 6 7 21 22 23 24 Input: 4 111010011110110110111100 15 1 2 2 3 3 4 5 6 8 9 9 10 11 12 13 14 14 15 16 17 19 20 20 21 21 22 22 23 23 24 Example output: 1 2 3 4 11 12 5 6 8 9 10 18 7 13 14 15 16 17 19 20 21 22 23 24 Input: 4 101101111001111001001111 14 1 2 3 4 4 5 7 8 8 9 9 10 10 11 13 14 15 16 16 17 19 20 21 22 22 23 23 24 Example output: 1 2 3 4 5 12 6 13 14 15 16 17 7 8 9 10 11 18 19 20 21 22 23 24 Input: 3 111111111111000000 9 1 2 1 13 3 4 5 6 6 7 8 15 10 16 11 17 12 18 Example output: 1 2 8 9 13 15 3 4 10 11 16 17 5 6 7 12 14 18 |
| WA7 | OpiumCat`~ | 1438. Time Limit Exceeded | 7 Apr 2025 12:34 | 1 |
WA7 OpiumCat`~ 7 Apr 2025 12:34 My program was skipping only empty lines, and I was getting WA7. When I started skipping lines consisting only of spaces, I got AC. |
| What's problem with my algo??? | gio_gio | 2034. Caravans | 2 Apr 2025 18:17 | 8 |
I run 2 bfs. The first bfs starting from node S (that is caravan's distances) and the second starting from node R (that's distances from robbers). Then i recover route for caravan and on each step backward i choose node with maximum robber distance. Minimum of robber distance on the caravans path is the answer. What's wrong? It's because you can't greedily choose the node with the maximum robber distance. One of the other paths might contain a node with a smaller node distance somewhere further along. One such graph is here (this one is rather long, you probably just want to try to generate a graph that violates your greedy strategy yourself): 15 20 1 2 2 4 4 6 6 8 1 3 3 5 5 7 7 6 4 5 2 3 7 8 7 9 9 10 10 11 11 12 12 6 11 14 14 13 13 15 15 3 1 8 11 One strategy that works is to BFS backwards from the finishing vertex, and along each path you maintain the minimum robber distance. When two (or more) paths merge on some vertex, you consider the minimum of this path to be the maximum of the minimums of the two paths. Otrebus, thank you for strategy ! what will be the ans of this case, could you tell me please??? i am also getting 3 for this case but wrong answer on test case #2 .. That's an intersesting strategy. Now I have to find out how do you know when some paths emerge on some vertex |
| some tests | LeTim | 1555. Find the Treasure! | 2 Apr 2025 17:41 | 1 |
Input: 2 .-.... |1|... ...... ....-. |*..2| .-..-. Output: Draw Input: 5 ............... .1||....||..... ............... ............... ..||..|.||.||.. ............... ............... ..||.||.||.||.. ............... ............... ..||.||*|..||.. ............... ............... .....||....||2. ............... Output: Win 33 M2 Input: 5 ............... .1||....||..... ............... ............... ..||..|.||.||.. ............... ............... ..||.||.||.||.. ............... ............... ..||.||.|..||.. ............... ............... .....||*...||2. ............... Output: Draw Input: 6 .-..-..-..-..-..-. |1...............| .................. .................. |................| .................. .................. |......*.........| .................. .................. |................| .................. .................. |................| .................. .................. |...............2| .-..-..-..-..-..-. Output: Win 15 M2 (or Win 15 M6, does not matter) Input: 6 .-..-..-..-..-..-. |1...............| .................. .................. |................| .................. .................. |.........*......| .................. .................. |................| .................. .................. |................| .................. .................. |...............2| .-..-..-..-..-..-. Output: Draw Input: 6 .-..-.....-..-..-. |1...............| .................. .................. |................| .................. .......-.......... ......|*.........| .................. .................. |................| .................. .................. |................| .................. .................. |...............2| .-..-..-..-..-..-. Output: Lose 1 S5 Edited by author 02.04.2025 17:51 |
| Can anybody email me the dp solution? | Geekmen | 1627. Join | 1 Apr 2025 14:37 | 1 |
I've used dp solution accepted. But I think my approach is a bit awful. So, I'd like to see some nice dp approaches. Thank you! Email: shiyuyang032421@gmail.com |
| is sample correct? | Shen Yang | 1799. Sasha and swag strings | 31 Mar 2025 22:17 | 4 |
in second sample suffix tree ,you can't get suffix aa from root to leaf,in the picture... I think correct output of sample 2 is 16. I think correct output of sample 2 is 16. |
| 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; } |
| 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 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 |