| Show all threads Hide all threads Show all messages Hide all messages |
| WA26 | andreyDagger`~ | 2041. Nanomatryoshkas | 13 Apr 2023 00:32 | 1 |
WA26 andreyDagger`~ 13 Apr 2023 00:32 Check your "MAXN" constant |
| Any hint for WA29 | Hristo Nikolaev (B&W) | 1846. GCD 2010 | 12 Apr 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. Robot in the Field | 12 Apr 2023 21:26 | 4 |
|
| WA4 | Ilya | 2141. Sasha Vilkin | 11 Apr 2023 23:12 | 2 |
WA4 Ilya 11 Oct 2022 15:56 Re: WA4 Hristo Nikolaev (B&W) 11 Apr 2023 23:12 7 6 -4 0 -1 -5 7 -10 Answer: 21 |
| Levit algorithm | Igor Parfenov | 1237. Evacuation Plan | 11 Apr 2023 03:28 | 1 |
I firstly tried to solve it with Ford-Bellman algorithm, but got TL and could not make it pass. Then I found here https://e-maxx.ru/algo/min_cost_flow Levit algorithm, and it passed. |
| Problem 1429. Biscuits rejudged | Vladimir Yakovlev (USU) | 1429. Biscuits | 10 Apr 2023 20:30 | 1 |
A new constraint on the input added: “It is guaranteed that any two distinct intersection or touch points of the cutting circles lay at the distance of at least 10^-3.” The tests not satisfying this constraint were corrected or removed. Some new tests were added at the same time. The time limit was adjusted to 1 sec. All solutions have been rejudged. 23 authors lost, and 13 other authors gained the solved status for the problem. |
| Why does my code get runtime error at test #6? | Maxim Rodionov | 1440. Training Schedule | 10 Apr 2023 02:40 | 1 |
Im an idiot I wrote "Saturtay" instead Saturday Edited by author 10.04.2023 02:46 |
| AC in 0.09 ... a hint | Христо Попов (B&W) | 1726. Visits | 9 Apr 2023 18:52 | 3 |
After some failed attempts with O(n)=n*n/2, finally I found an O(n)=n solution. In plain C, it took 0.09s and 1.5Mb. (just from curiosity tried the same with C# - 14MB used RAM :)) The arrays of X and Y coordinates can be sorted independently from each other. So basically, this input: 3 1 3 2 1 3 2 will have exactly the same result (which is 2) as 3 1 1 2 2 3 3 Assuming a (x1, y1), b (x2, y2), then the distance from c (x3, y3) to (x1, y1) and (x2, y2) is equivalent to the distance from (x1, y2) and (x2, y1) |
| My bad | Evgeniy Park | 2145. Olympiad for Everyone | 6 Apr 2023 18:47 | 1 |
My bad Evgeniy Park 6 Apr 2023 18:47 My bad accepted, best Go solution to date Edited by author 06.04.2023 19:36 |
| If you have WA 48... | wery0 | 1075. Thread in a Space | 5 Apr 2023 10:58 | 1 |
Try this test: -10 -1 1 -1 8 1 -7 2 1 3 Answer: 14.38 |
| TLE 41 | Smetya | 2102. Michael and Cryptography | 2 Apr 2023 23:37 | 1 |
TLE 41 Smetya 2 Apr 2023 23:37 who has ideas, what test it is? |
| My PIBAS program has only 92 char | Ade | 1230. Introspective Program | 2 Apr 2023 16:00 | 1 |
|
| Test 23 | Daniial | 2102. Michael and Cryptography | 2 Apr 2023 15:57 | 2 |
Help please: Test 23, whats wrong, what test should chek? def sieve(n): lis = list(range(n + 1)) lis[1] = 0 for i in lis: if i > 1: for j in range(i + i, len(lis), i): lis[j] = 0 return [i for i in lis if i != 0] c = sieve(200) a = int(input()) if a == 0: print('No') i = 0 b = [] e = 0 while a != 1: if a%5 != 0 and a%2 != 0 and a%3 != 0: e +=1 break elif a % c[i] == 0: a /= c[i] b.append(c[i]) continue else: i += 1 d = str(len(b)) if len (b) == 20 or (len (b) == 19 and e != 0): print('Yes') else: print('No') In this code possible i > len(c) |
| hint for WA#2 | Accepted | 1423. String Tale | 31 Mar 2023 17:48 | 4 |
such data: 3 aaa aaa the answer is 0 rather than 3 I mean, it works, but the statement says that "If the problem has several solutions, you may output any of them". Obviously, 3 is the correct answer as well. So I guess it's test/statement problem? |
| Test for WA#5 | Pat | 1671. Anansi's Cobweb | 30 Mar 2023 13:07 | 1 |
5 8 2 3 1 2 2 5 1 4 1 5 3 4 3 4 4 4 8 7 6 8 2 3 4 5 1 > 1 1 1 1 2 3 4 5 |
| Idea | Hristo Nikolaev (B&W) | 1671. Anansi's Cobweb | 29 Mar 2023 21:04 | 1 |
Idea Hristo Nikolaev (B&W) 29 Mar 2023 21:04 Instead of doing the cuts in the order given in the input, I found it easier to do it in reverse order, so we get merging instead of cutting. Edited by author 29.03.2023 21:05 |
| I will just post the soution because i want to ruin it for you ;) | Ishan Pandey | 1930. Ivan's Car | 28 Mar 2023 23:19 | 3 |
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define int long long #define mod 1000000007 #define maxn 10010 #define pb push_back #define mp make_pair #define fi first #define se second #define inf 100000000000 vector<pair<int, int>> adj[maxn]; int n, m; // struct node //for edges // { // int pos, dir, dist; // node(){}; // node(int _pos, int _dir) // { // pos = _pos; // dir = _dir; // } // }; int go(int s, int e) {
int dist[maxn][2]; for(int i=0; i<maxn; i++) { for(int j=0; j<=1; j++) { dist[i][j] = inf; } } deque<pair<int, int>> q; //pair->{node, edgedir} //making direction list here, q.push_back({s, 0}); //0->outgoing to node s dist[s][0] = 0; q.push_back({s, 1}); //1->incoming from node s dist[s][1] = 0; while(!q.empty()) { pair<int, int> cur = q.front(); //node int v = cur.first; int dir = cur.second; //dist int dv = dist[v][dir]; //guarenteed that shortest dist till cur node has been calc already q.pop_front(); //if(dv == inf) break;
if(cur.first == e) return dv; //gauarenteed via djikstra that this willbe minimest
//relax all the neighbours, and as you relax one , push into minheap the nodes for(auto it: adj[v]) { int to = it.fi; int dir2 = it.se; //previous //note that for type edge dir, you have relax for all neighbouring nodes int dist2=0; if(dir2 == dir) { dist2 = dist[v][dir2]; //dist[to][dir2] = min( dist[to][dir2], dist[v][dir2] ); } else dist2 = dist[v][dir] + 1; // dist[to][dir2] = min( dist[to][dir2], dist[v][dir] + 1);
//only relax and add to queue, if less than prev distance to this node if(dist2 < dist[to][dir2]) { if(dist2 <= dv) //less than equal to cur_dist q.push_front({to, dir2}); else q.push_back({to, dir2});
dist[to][dir2] = dist2;
}
} } return -1; } void solve() { cin>>n>>m; for(int i=1;i<=m;i++) { int x, y; cin>>x>>y; adj[x].pb({y, 0}); adj[y].pb({x, 1}); } int s, e; cin>>s>>e; //cout<<"hi"; int ans = go(s, e); cout<<ans<<endl; } signed main() { int t=1; //cin>>t; while(t--) { solve(); } return 0; } I do not understand the final push back and front part. Why to push only if dist is less than dv? Why are we comparing it to dv? If it is for the right position in the queue of the pushed element(like in 0-1 bfs),then how do we know that the queue only has 0-1? That is the underlying part of the 0-1 bfs right?else it is dijkstra. I think the queue has difference of 1 between its min and max. Can you tell what all is true and exactly what is happening. I would really appreciate. Thank you Edited by author 04.05.2020 20:46 Edited by author 04.05.2020 20:47 if(dist2 <= dv) //less than equal to cur_dist q.push_front({to, dir2}); else q.push_back({to, dir2}); CAN YOU EXPLAIN ME THIS PART WHY DIST 2 GREATER IS PUSHED BACK NOT IN FRONT AND VICE VERSA WHAT I MEAN TO KNOW IS WHY WE COMPARE CONNECTED VERTEX DISTANCE |
| I got AC! But i have question | Felix_Mate | 1437. Gasoline Station | 28 Mar 2023 13:43 | 3 |
Я решил задачу с помощью графа, где вершинки - состояния ёмкостей,и рассмотрел из очередного состояния все переходы, запоминая те состояния ,где уже был. Но я никак не могу оценить кол-во возможных состояний. Может кто-нибудь подскажет как оценить? Самая грубая оценка - у нас есть числа a,b,c>=0 и a+b+c=N(для случая,когда не подливаем и не выливаем-в этом случае сумма константа). Тогда количество таких чисел O(N^3),но это ужасная оценка. Согласен, было бы интересно узнать максимальное количество возможных состояний и при каких значениях a,b,c оно достигается Edited by author 16.11.2019 13:00 Можно оценивать так: пусть ёмкости не превосходят значения C. Рассмотрим возможные переходы между состояниями. 1) Когда подливаем из заправки в канистру. Тогда канистра, в которую подливаем, становится полной. 2) Когда переливаем между канистрами. Тогда либо канистра, в которую переливаем, становится полной, либо канистра, из которой переливаем, становится пустой (либо и то, и то). Получается, что в каждом состоянии хотя бы одна канистра либо пустая, либо полная. Тогда количество состояний можно оценить как 6*(С+1)^2, то бишь O(C^2). |
| Please tell me what is the test 6? | quocanh34 | 1604. Country of Fools | 27 Mar 2023 22:09 | 1 |
|
| If you have WA #9 | Smilodon_am [Obninsk INPE] | 1982. Electrification Plan | 27 Mar 2023 17:15 | 7 |
First I used Kruskal algo but got WA9 verdict. My program didn't give right answer for next test: 4 1 4 0 1 1 100000 1 0 1 100000 1 1 0 100000 100000 100000 100000 0 right answer: 100002 Implementation of Prim algo gave the correct answer at last. HM, i have right output on this test, but WA 9 This test helped me.... 5 2 1 3 0 1 2 3 4 1 0 2 3 4 2 2 0 3 4 3 3 3 0 4 4 4 4 4 0 =8 (I was getting 9). Basically my algorithm (roughly Prim's) tried to short-cut checking vertex weights. For any node, make sure you check verices to ALL nodes.... HM, i have right output on this test, but WA 9 Some tests: 4 2 1 4 0 4 8 9 4 0 2 7 8 2 0 1 9 7 1 0 Answer 3 4 2 1 3 0 6 7 8 6 0 2 3 7 2 0 4 8 3 4 0 Answer 5 Edited by author 27.10.2015 20:10 5 3 1 3 2 0 1 2 3 4 1 0 2 3 4 2 2 0 3 4 3 3 3 0 4 4 4 4 4 0 answer is 7 Edited by author 19.02.2019 12:09 One more test that helped me to find my error for WA #9. 5 2 1 5 0 1 100 150 200 1 0 10 50 200 100 10 0 11 100 150 50 11 0 2 200 200 100 2 0 Answer: 13 c[i][j] = c[j][i] This is wrong test |