### DishonoredRighteous's blog

By DishonoredRighteous, history, 9 months ago,

1679A - AvtoBus

Author: iakovlev.zakhar

Preparation: DishonoredRighteous

Editorial: DishonoredRighteous

Editorial

1679B - Stone Age Problem

Author: Kon567889

Preparation: Kon567889

Editorial: DishonoredRighteous and Kon567889

Editorial

1679C - Rooks Defenders

Author: Kon567889

Preparation: Kon567889

Editorial: DishonoredRighteous and Kon567889

Editorial

1679D - Toss a Coin to Your Graph...

Author: Kon567889

Preparation: Masha237

Editorial: DishonoredRighteous

Editorial

1679E - Typical Party in Dorm

Author: andr1y and welleyth

Preparation: andr1y and welleyth

Editorial: andr1y and welleyth

Editorial

1679F - Formalism for Formalism

Author: iura

Preparation: iura

Editorial: DishonoredRighteous

Editorial

• +130

 » 9 months ago, # |   +35 I hope you enjoyed this round!
•  » » 9 months ago, # ^ | ← Rev. 4 →   +5 Can anyone please tell, whats wrong with this solution ? https://codeforces.com/contest/1679/submission/157267162 WA on test 5Thanks
•  » » » 9 months ago, # ^ | ← Rev. 2 →   0 Failing testcase: Ticket 7274
 » 9 months ago, # | ← Rev. 2 →   +65 I believe that E would be much easier to understand with a formal definition. Let $k$ be the number of '?' in $s$. For a given string $t$ with unique characters, let $sub_t(s)$ be the set of all $|t|^k$ ways to substitute a character from $t$ in each '?' in $s$. Let $f(s)$ be the number of pairs $1 \le i \le j \le n$ such that the string $s[i : j]$ is a palindrome, where $s[i : j]$ is the substring of $s$ from $s[i]$ to $s[j]$. Given $q$ queries of string $t_i$, compute and print $\sum_{str \in sub_{t_i}(s)} f(str)$for each query.It removes a lot of ambiguity from the statement, and is easier to understand.
 » 9 months ago, # |   0 ** function of existence of the answer relatively to the minimum value of the maximum in the path is monotonous.** can anyone please provide me an example of this
 » 9 months ago, # |   +4 E good problem,but didn't solve.qwq
 » 9 months ago, # |   0 It seems that segment tree solution is acceptable for C but much slower. I don't know if it is because segment tree itself is so slow? Or is segment tree theoretically acceptable for this problem?(the time limit of 1000ms is a bit short for segment tree solution)My submissions: TLE 157157377 157159053 AC 157166835
•  » » 9 months ago, # ^ |   +5 Pretty sure it's just cin/cout throwing a hissy fit. My submission used scanf/printf and passed without any compiler optimizations at 343ms. 157161379
•  » » » 9 months ago, # ^ |   0 yeah I noticed that I ACed after ios::sync_with_stdio(false)
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   0 This happened the same to me. Are there any reasons behind using it? I never ever used ios::sync_with_stdio(false), what does it do anyway?I used this stack overflow link but it wasn't clear much
•  » » » » » 9 months ago, # ^ | ← Rev. 3 →   +3 In a nutshell: Sets whether the standard C++ streams are synchronized to the standard C streams after each input/output operation. It is often recommended to use scanf/printf instead of cin/cout for fast input and output. However, you can still use cin/cout and achieve the same speed as scanf/printf by including the following in your main() function: ios_base::sync_with_stdio(false); By default, it is set (true); By turning it off(false), you avoid synchronization with C; Read more here: https://www.geeksforgeeks.org/fast-io-for-competitive-programming/ Or here:https://en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio
•  » » » » » » 9 months ago, # ^ |   0 Thanks it was informative
•  » » » » 5 months ago, # ^ |   0 Hey sorry to disturb, but I too used segment tree but with rangeSum, here is my submission can you please tell me why would it give me WA on tc 3
•  » » » 9 months ago, # ^ |   0 Always use scanf and put, i solved with Fenwick tree and without scanf i got TLEhttps://codeforces.com/contest/1679/submission/157585528
•  » » 9 months ago, # ^ |   +5 Might be your segtree since mine runs under 300 ms.https://codeforces.com/contest/1679/submission/157174312
•  » » » 9 months ago, # ^ |   0 I will improve my segment tree. thx!
•  » » » 9 months ago, # ^ |   0 Thank you for sharing your implementation :D, I could improve my segment tree. JIC is here: https://codeforces.com/contest/1679/submission/157264397
•  » » » » 9 months ago, # ^ |   +12 Actually it's pashka's segment tree from his segment tree EDU tutorial 😄
•  » » » 5 months ago, # ^ |   0 Hey sorry to disturb, but I too used segment tree but with rangeSum, here is my submission can you please tell me why would it give me WA on tc 3
•  » » » » 5 months ago, # ^ |   0 Hey. Even i tried range sum approach using segment tree. But I'm getting WA on test 3.. Can u tell how you corrected it and got AC.
•  » » » » » 5 months ago, # ^ |   0 Take a look at Ticket 16173 from CF Stress for a counter example.
•  » » » » » » 5 months ago, # ^ |   0 thank you
•  » » » » 5 months ago, # ^ |   0 Take a look at Ticket 16175 from CF Stress for a counter example.
 » 9 months ago, # |   0 I like this round very much. Thanks for all of the people who organized this round.
 » 9 months ago, # |   0 In first question i am unable to understand that how in case of minimization of buses the answer is n/6...please explain
•  » » 9 months ago, # ^ |   +1 Since n cannot be odd, n should be even. Also n cannot be equal to 2. So n should be from the set {4,6,8,10.....}. Which means when divided by 6 the remainder will be either 0 or 2 or 4. Let x = n/6 and r be the remainder. If r is 0, you have all busses with 6 wheels, answer is x. If r = 4 you have x busses with 6 wheels and left with 4 wheels. So you can add a bus with 4 wheels, final answer becomes x+1. If r = 2, you have x busses with 6 wheels and note that x >= 1. You can remove a bus with 6 wheels and add 2 busses of 4 wheels. Answer again become x-1+(2) = x+1. So simply put it will be the ceil of n/6.
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 N is the number of wheels, when we want to minimize the number of buses we will want the max buses to be with 6 wheels as that will reduce the number of buses. Now n is even, there can be 3 cases: 1- when n % 6 == 0: then the answer will be n/6. 2- when n%6 == 2: then if we have n/6 buses with 6 wheels, two wheels will be left, so we will get n/6 — 1 buses with 6 wheels, and 2 buses with 4 wheels(as now we have 2 + 6 wheels left) that makes n/6 + 1 i.e. ceil of n/6. 3- when n%6 == 4: then we will have n/6 buses with 6 wheels and 1 bus with 4 wheels, total n/6 + 1 i.e. ceil of n/6.Jai BajrangBali.
•  » » » 9 months ago, # ^ | ← Rev. 2 →   0 thankyou @vineetwidhani01 i got it now Jai Bajrang bali
 » 9 months ago, # |   +1 Can I ask that in Div2C, how we can use binary search to check whether that sub rectangle will be attacked by the rock?
•  » » 9 months ago, # ^ | ← Rev. 3 →   0 Imagine you have a sorted set of rows and columns that do not have any rooks on them.Let's say, given n = 10, the the set for the rows is : 1 2 3 4 10the the set for columns is : 2 3 6You've got a query : 3 5 4 9 7To answer the query what you have to do is to find the first element in the set of rows that is equal or greater than 5 and find the first element in the set of columns that is equal or greater than 4.You can use binary search to find them in log(n) time. lower_bound(5) = 10 lower_bound(4) = 6So, that means you must have rooks on rows from 5 to 9, and on columns from 4 to 5. As we have every row from query covered by at least one rook, the answer is "Yes".
•  » » » 9 months ago, # ^ |   0 ok I understand, thank you too much
 » 9 months ago, # |   0 In problem C, why this submission is WA and the other one is AC if they are pretty similar, I literally copy my previous segment tree methods into a struct with a few improvements. I couldn't find the bug :'(
•  » » 9 months ago, # ^ |   0 Read my comment posted below https://codeforces.com/blog/entry/102859?#comment-912796
 » 9 months ago, # |   0 can someone tell me why my C got FST
 » 9 months ago, # |   0 Problem C : can someone tell me on which test case my code fails it give me WA on test 3 [27284th token]Click here 157271735
•  » » 9 months ago, # ^ |   0 You can have more than one rook in a row/column. Since you are using your boolean array as an indicator of whether there is a rook in a particular row/column or not, you need to set/unset only when there is a new rook in that row/column or the current rook removed was the only rook of that row/column
•  » » » 9 months ago, # ^ |   0 ohh Man That's great Count also matter Number of rook on the same row or columns could be more than one i want to make boolean value false when count of rook is zero on particular row and column Thanks for the clarification
•  » » » 9 months ago, # ^ |   0 Problem C :Hi, can any one tell me what I'm doing wrong, I'm trying to solve the problem using BIT where the first pointer is 0 if no rock in line|column and 1 meaning at least a rock in the line|column, and the second one is the number of counts of rocks in that line|column , plz help me I toke more then 4 hours not finding the mistake. int n, q; int lowbit(int x) { return (x&-x); } void upd(int idx, int v, vii &ff) { for(;idx<=n; idx+=lowbit(idx)) ff[idx].f += v; } int sum(int idx, vii &ff) { int ans = 0; for(;idx; idx-=lowbit(idx)) ans += ff[idx].f; return ans; } void solve() { cin >>n >>q; int t, x, y, x1, y1; vii f1(n+1, MP(0, 0)), f2(n+1, MP(0, 0)); while(q--) { cin >>t>>x>>y; if(t == 1) { f1[x].s++; f2[y].s++; if(f1[x].f == 0) upd(x, 1, f1); if(f2[y].f == 0) upd(y, 1, f2); }else if(t == 2) { f1[x].s--; f2[y].s--; if(f1[x].s == 0) upd(x, -1, f1); if(f2[y].s == 0) upd(y, -1, f2); }else { cin>>x1>>y1; int ans1 = sum(x1, f1) - sum(x-1, f1); int ans2 = sum(y1, f2) - sum(y-1, f2); if(ans1 == x1-x+1 || ans2 == y1-y+1) cout<<"yes\n"; else cout<<"no\n"; } } } 
•  » » » » 9 months ago, # ^ |   0 if(t == 1) { f1[x].s++; f2[y].s++; if(f1[x].s == 1) upd(x, 1, f1); if(f2[y].s == 1) upd(y, 1, f2); }i think it's clear since you have to add 1 if the counter is 1 (was 0), or add -1 if the counter is 0 (was 1).
•  » » » » » 9 months ago, # ^ |   +5 I got it, Thanks my friend for helping me ^_^.
 » 9 months ago, # |   0 If you are/were getting a WA/RE verdict on problems from this contest, you can get the smallest possible counter example for your submission on cfstress.com. To do that, click on the relevant problem's link below, add your submission ID, and edit the table (or edit compressed parameters) to increase/decrease the constraints. If you are not able to find a counter example even after changing the parameters, reply to this thread (only till the next 7 days), with links to your submission and ticket(s).
 » 9 months ago, # |   0 Can someone please tell me what is wrong with my code for the problem C. https://codeforces.com/contest/1679/submission/157259885
•  » » 9 months ago, # ^ |   0 You have not considered the case for multiple rooks in row/column
 » 9 months ago, # |   0 Can someone please explain why my submission for C is giving TLE. 157292933Thanks
•  » » 9 months ago, # ^ |   0 use fast input output I got AC with your code, Time Limit is too tight
•  » » » 9 months ago, # ^ |   0 Do you have information about where I can find the solution of fast IO for c++?
•  » » » » 9 months ago, # ^ |   0 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); Add these 2 lines in your main Function, you can read more about it Stack Overflow
•  » » » » » 9 months ago, # ^ | ← Rev. 2 →   0 TASK C TL, test 3Thank you. May I ask you to look quickly for submission, please? https://codeforces.com/contest/1679/submission/157302795
•  » » » » » 9 months ago, # ^ |   0 Oh, god. I remember that lower_bound should be called like a method of the set.
•  » » » 9 months ago, # ^ |   0 Thanks
 » 9 months ago, # |   0 RMQ using segment treestruct SegTree { // 1 indexed int size; vi arr; void init(int n){ size=1; while(size=r||l>=rx) return LLONG_MAX; if(lx>=l&&rx<=r) return arr[x]; int m=(lx+rx)/2; int s1=query(l, r, 2*x+1, lx, m); int s2=query(l, r, 2*x+2, m, rx); // change here fr range max queries return min(s1,s2); } int query(int l, int r) { return query(l, r, 0, 0, size); }};I don't know what to arr.assign()(is it also 0?) for range max queries. I hope the rest of the changes are correct for range max queries. Can anyone help me with it please?
 » 9 months ago, # | ← Rev. 2 →   0 Why this submission gets time limit. Can any one explain? I just run loop of O(n+q). Problem: B My submission link 157195608
•  » » 9 months ago, # ^ |   0 This is O(n + n*q) as you are making a new vector in each query!!
•  » » » 9 months ago, # ^ |   0 Okay, thanks for making me understand.
 » 9 months ago, # | ← Rev. 2 →   0 Which test case I am missing in problem B? 157192323. I am getting WA on test 2 with message: wrong answer 58999th numbers differ — expected: '32583263977149', found: '32583727669172'.
•  » » 9 months ago, # ^ |   +1 Failing testcase: Ticket 7208
 » 9 months ago, # |   0 Can somebody show me the problem C solved like is told in editorial please? I tried different methods except tree metods , and have time limit at 41 test case.
 » 9 months ago, # |   0 I liked problem B.I mean I could not solve it on my own, but the editorial solution was pretty smart (for me at least)
 » 9 months ago, # |   0 My logic to A solution started from:initial equation: $4 \cdot x + 6 \cdot y = n$a note: $4 \cdot 3 = 6 \cdot 2$, so we can replace an equation with $4 \cdot x + 4 \cdot 3 \cdot y = n$ (if $y$ is even) or $4 \cdot x + 4 \cdot 3 \cdot y + 6 = n$ (if $y$ is odd).We can check if $y$ is even, what possible when $n$ mod 4 = 0, and if $y$ is odd, what is possible when $(n - 6)$ mod 4 = 0. Otherwise (and in case with $n = 2$) there is no answer.
 » 9 months ago, # |   0 Someone please help with problem A, I just can't understand it no matter how many times I've read the editorial
 » 9 months ago, # | ← Rev. 2 →   0 the author said for Problem D : it's a well-known classical problem.Can anyone suggest some similar problems or the classical one that the author is talking about?
•  » » 9 months ago, # ^ |   0 Here are some problems which are quite similar to problem D from this round:EDU 128 CEDU 126 C
•  » » » 3 months ago, # ^ |   0 He meant the dp problem, not the binary search problem
 » 9 months ago, # |   0 In problem-4 it is mentioned that, It's guaranteed that graph doesn't contain loops and multi-edges. I want to know what is meant by loop? Is it different from cycle?
•  » » 9 months ago, # ^ |   +1 loop is an edge that connects a vertex to itself
•  » » » 9 months ago, # ^ |   0 oh ok now i understand. Thanks!
»
9 months ago, # |
-11

how does this code works for B

# define ll long long

using namespace std;

int main() {

# ifndef ONLINE_JUDGE

freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

# endif

ll n, p, q, sum = 0, temp = 0;
map<ll, ll> mp;
cin >> n >> q;
for (ll i = 0; i < n; i++)
{
cin >> p;
mp[i] = p;
sum += p;
}
while (q--)
{
ll pos, x, t;
cin >> t;
if (t == 1)
{
cin >> pos >> x;
pos--;
if (mp.find(pos) == mp.end())
{
sum = sum - temp + x;
mp[pos] = x;
}
else
{
sum = sum - mp[pos] + x;
mp[pos] = x;
}
}
else
{
cin >> x;
mp.clear();
temp = x;
sum = temp * n;
}
cout << sum << endl;
}

} The time complexity is o(n+n*q) n and q is 2*10^5 so how is it able to work .The clear function takes o(n) time and if we just replace clear function with a for loop with makes the element of the array equal to x it shows TLE . Pls somebody who knows or implemented the same kind solution help me to understand ?? sorry for my pathetic english xd

•  » » 9 months ago, # ^ |   0 Yes, clearing the map takes $O(N)$, but it isn't $O(N+NQ)$, because sum of all sizes of map can be at most Q (at most 1 element can be added to map during each iteration). That is why this solution works in $O(N+QlogQ)$.
•  » » » 9 months ago, # ^ |   0 how is log(q) coming I can't get it. suppose after initialising the array the first query is of type 2 then u have to remove the array by mp.clear() similarly if all query is of type 2 then would"nt it take n*q ??
•  » » » » 9 months ago, # ^ | ← Rev. 2 →   0 $QlogQ$ appears from calling map, because every call of map is made in $O(logSZ)$, where $SZ$ is size of the map.Let's suppose, you have 2 elements in array, then you cleared it, added another 4 elements, and cleared it again. The first clearing method was done in 2 operations, and second was done in 4 operations. So, if we write down sizes of map before each clearing, let it be $sz_1, sz_2, ... , sz_k$. It easy to see that $\sum_{i=1}^ksz_i \le Q$. So all clearing operations take at most $O(Q)$.PS: I actually don't know, is clearing is done in $O(SZ)$ or in $O(SZlogSZ)$ :thinking: :/
 » 9 months ago, # |   0 Video Solution for Problem D.
 » 9 months ago, # |   0 Can anyone post the editorial for C in easy words?
•  » » 9 months ago, # ^ | ← Rev. 2 →   -6 If there is a query box with width W and height H, then to cover each cell there must be at least one rook in each row in the box, or at least one rook in each column in the box. So, if there is a row and a column in the box which don't have a rook in them, then there is a cell that is not covered. Otherwise, all cells are covered.We can do two(one for columns, one for rows) Segment Trees with checking, if there is a zero in the segment. If we add rook, we add +1 to the column and row in the trees. If we remove rook, than we add -1.
•  » » » 9 months ago, # ^ | ← Rev. 2 →   +5 If you don't know segment tree, you can also solve it by just using set ( one for column and one for row ) , let the set store the rows for which cnt[i]=0 , so if we remove a rook with {x,y} , we can add x back to row set if we have 0 rook in x row , and if we add a rook to set , we can erase x from row set , same goes for column set .
•  » » » » 6 months ago, # ^ |   0 This can be solved by using Square Decomposition too. Strangely enough, I've seen Segment Tree solutions which ran slower than my solution (These have almost the same optimization as mine), despite Seg tree has the complexity of O(N log N), and Square Decom has the complexity of O(N sqrt N). 165773252
 » 9 months ago, # | ← Rev. 2 →   0 https://codeforces.com/contest/1679/submission/157366338 can anybody tell me why this code is is giving WA For problem C
•  » » 9 months ago, # ^ | ← Rev. 2 →   0 Failing testcase: Ticket 7272
•  » » » 9 months ago, # ^ |   0 thanks
 » 9 months ago, # |   0 can someone explain me their segment tree approach for B
 » 9 months ago, # |   0 Please can anyone tell me what's wrong with this solution: https://codeforces.com/contest/1679/submission/157426825 ?
 » 9 months ago, # |   0 I have written the code for Problem B. It's getting accepted but I am confused of why this solution is working under time limit. Can somebody help me with this? here is the submmison.
 » 9 months ago, # | ← Rev. 2 →   0 Thanks for interesting problems!) In problem C I have the solution that has TL3 (https://codeforces.com/contest/1679/submission/157589950) without writing the "ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);" line at the beginnig of programm. But the same solution with the "ios" line (https://codeforces.com/contest/1679/submission/157589989) works correctly. That's kinda sad when something like this happens(
 » 9 months ago, # |   0 For problem C, I used a square root decomposition data structure to pre-calculate query results (number of rooks in ranges of rows/columns). The solution seems to be fast enough as it has passed so many cases. My solution (https://codeforces.com/contest/1679/submission/157520096) produces wrong answer on test 35. Can anybody provide some insight on what might be wrong with my solution?
•  » » 9 months ago, # ^ | ← Rev. 2 →   +3 Failing testcase: Ticket 7271
•  » » » 9 months ago, # ^ |   0 Thanks. Have found the error. Problem solved.
 » 9 months ago, # |   0 Can someone please help why am I getting tle for this https://codeforces.com/contest/1679/submission/157165756 solution; question: https://codeforces.com/contest/1679/problem/B
 » 9 months ago, # |   0 Can someone please explain the logic behind problem B? Thanks in advance!
 » 9 months ago, # |   0 Hi, Could someone please help me out? Am not able to understand why https://codeforces.com/contest/1679/submission/157598442 throws TLE in test 7. Approach: 1. Binary search over possible answer 2. for a potential solution x, build graph with only edges where both vertices are valid (a[node] <= x) O(m) 3. Dfs to check for cycle- 2 times dfs (To compute tin, tout for nodes and then to check) O(m+n) 4. If not cycle dfs to get the longest path O(m+n) Complexity is be O(m+n)*log(MAX)
 » 9 months ago, # |   0 For problem C, if using C++, what data structure is used to store freeRows? If we use vector, insert an element in order will need O(n) time complexity? If we use set or list, we cannot do binary search for query type 3?
•  » » 9 months ago, # ^ |   0 Seems we should just use "set"? But I got TLE: https://codeforces.com/contest/1679/submission/157773752I see most acceptable solution uses BIT. Any acceptable solution uses the algorithm described in the tutorial?
•  » » » 9 months ago, # ^ |   0
•  » » » » 8 months ago, # ^ |   0 Thanks! But it is interesting that it is TLE now with the same implementation.
•  » » » » » 7 months ago, # ^ |   0 The issue is not due to set (which is very fast), but because your I/O (cin, cout) is too slow (due to syncing with stdio). In particular, the input may have a very large number of values, so the syncing delay causes TLE. For fast I/O with cin and cout, you should add the following two lines to the start of your main function (or anywhere before the first use of cin/cout): ios_base::sync_with_stdio(false); cin.tie(NULL); Note that if you do this, then you shouldn't use scanf/printf alongside cin/cout, since they are not synchronized (e.g., a later scanf would read the same data that an earlier cin already read). This is fine if you don't use scanf/printf anyway.Yes, I know your comment is two months old, but I noticed that even your latest submissions continue to use cin/cout without disabling the synchronization, so I advise you to add those two lines to your template before you encounter another TLE in the future due to I/O syncing delays.
•  » » » » » » 7 months ago, # ^ |   0 Hi, thank you so much for the excellent explanation and suggestion! Really appreciate :)
•  » » 9 months ago, # ^ |   0 I am facing same problem.
 » 9 months ago, # |   0 does it say "Unable to parse markup [type=CF_MATHJAX" just for me when the editorial button is clicked on problem C?
•  » » 9 months ago, # ^ |   0 The same for all buttons except A.
 » 9 months ago, # |   0 A wonderful contest with problems of different level, and they are expecially suitable for a Chinese like me to improve my skill for the coming competitions. The editorial is also up to standard.
 » 8 months ago, # | ← Rev. 2 →   0 can somebody provide answer to A problem. i'm not able to solve even after reading tutorial. messing something....my JS solution(**wrong**) function solve() { const n = BigInt(readLine()); let max = 0, min = 0; if (n % 4n != 0n && n % 6n != 0n) return "-1"; if (n % 2n === 0n) { max = n / 4n; min = n % 6n === 0n ? n / 6n : n / 6n + 1n; } else { max = n / 4n; min = n % 6n === 0n ? n / 6n : n / 6n + 1n; } return (min || max) + " " + (max || min); } 
•  » » 8 months ago, # ^ |   -10 Possibly BIgInt is supported by node v14+. code forces uses version 12
 » 8 months ago, # |   0 Why does this give a TLE, in spite of using sets? (the commented part is the previous solution, not using sets -- even that gives TLE at test-case 41, but this one gives TLE at test-case 3)
 » 8 months ago, # |   0 Wtf????
•  » » 8 months ago, # ^ | ← Rev. 2 →   0 There were some troubles with Russian editorials for problems B-F. We fixed them, Sorry for such a big delay.
 » 8 months ago, # |   0 In problem C same code 158393974 is getting AC in g++ 14 and g++ 17 but getting 158393870 WA in g++ 20 (64) can anyone help me understand why?
 » 8 months ago, # | ← Rev. 2 →   0 this code(C. Rooks Defenders) can anybody help why my code is giving wrong answer on 23649th token?,please please https://codeforces.com/contest/1679/submission/158499479
 » 8 months ago, # |   0 this code(C. Rooks Defenders) can anybody help why my code is giving wrong answer on 23649th token?,please please https://codeforces.com/contest/1679/submission/158499479
•  » » 8 months ago, # ^ |   0 Consider the test case that CF-Stress produces in Ticket 7742. Your code is giving wrong answer on that particular test case. It might help you in debugging your code.
 » 8 months ago, # |   0 can anybody help its failing in 2784th token? problem c https://codeforces.com/contest/1679/submission/158506989
 » 8 months ago, # | ← Rev. 3 →   0 Can anyone help me why my segment tree solution for problem C is giving TLE even after using fast_io. My submission: 158542039
•  » » 8 months ago, # ^ |   0 edit: I solved it using BIT it worked but why segment tree implementation is so, slow can anyone explain.
•  » » 5 months ago, # ^ |   0 Hey sorry to disturb, but I too used segment tree but with rangeSum, here is my submission can you please tell me why would it give me WA on tc 3
 » 8 months ago, # |   0 Do you know any similar problems to the 1679B — Stone Age Problem?
•  » » 8 months ago, # ^ |   0 No buddy, I haven't tried it yet. I am solving only C and D problems of all prev. contests as I am able to solve A and B in every contest.
 » 8 months ago, # | ← Rev. 2 →   0 If anyone is interested, problem C can be solved with sqrt decomposition. https://codeforces.com/contest/1679/submission/158598103 my submition
 » 8 months ago, # |   0 If someone wants Here is my Submission for Div2 D : Toss a coin to your graph
 » 8 months ago, # |   0 Can we solve div2A with binary search or linear Diophantine equation solution technique?
 » 8 months ago, # |   0 I solved 2nd question using segment tree and it got accepted code
 » 8 months ago, # |   0 Can someone help to debug my solution for problem D. getDepth function returns -3 if cycle is detected else returns it's depth.
•  » » 8 months ago, # ^ |   0 Consider Ticket 13728 from CF Stress. The expected output is 3, while your code produces 6.
•  » » » 8 months ago, # ^ | ← Rev. 2 →   0 Thanks very much!! It was a stupid bug in my code.
 » 6 months ago, # |   0 very nice tutorial for F
 » 4 months ago, # |   0 why am i getting wa on tc 3 [46944th token] [my solution](https://codeforces.com/contest/1679/submission/176050133)
•  » » 4 months ago, # ^ |   0 Take a look at Ticket 16279 from CF Stress for a counter example.