You can use several words in query to find by all of them at the same time. In addition, if you are lucky search understands word forms and some synonyms. It supports search by title and author. Examples:

  • 305 — search for 305, most probably it will find blogs about the Round 305
  • andrew stankevich contests — search for words "andrew", "stankevich" and "contests" at the same time
  • user:mikemirzayanov title:testlib — search containing "testlib" in title by MikeMirzayanov
  • "vk cup" — use quotes to find phrase as is
  • title:educational — search in title

Results

 
 
 
 
1.
By gepardo, history, 10 months ago, translation, In English
Editorial of Codeforces Round #672 (Div. 2) [problem:1420A] <spoiler summary="Hint"> Any array can be sorted using no more than $\frac{n(n-1)}2$ operations. Think or guess when we need exactly $\frac{n(n-1)}2$ operations. </spoiler> <spoiler summary="Solution"> [tutorial:1420A] </spoiler> <spoiler summary="Code in C++ (Wind_Eagle)"> ~~~~~ #include<iostream> using namespace std; int a[1000000+5]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin>>t; while (t--) { int n; cin>>n; for (int i=0; i<n; i++) { cin>>a[i]; } bool can=false; for (int i=1; i<n; i++) { if (a[i]>=a[i-1]) { can=true; break; } } if (can) cout<<"YES"<<'\n'; else cout<<"NO"<<'\n'; } } ~~~~~ </spoiler> [problem:1420B] <spoiler summary="Hint"> Think of a simple criteria when `a...
int main() { ios_base::sync_with_stdio(false);

Read more »

 
 
 
 
  • Vote: I like it
  • +314
  • Vote: I do not like it

 
 
 
 
2.
By linkret, history, 5 years ago, In English
Incredibly beautiful DP optimization from N^3 to N log^2 N The task I want to discuss is [problem:739E]. While the official solution is a greedy algorithm sped up enough to pass the time limit, I recently came upon another solution. The main idea is to speed up the obvious dp approach, where we define dp[i][x][y] as the maximum expected number of caught pokemon in the prefix of first i pokemon, if we throw at most x A-pokeballs and at most y B-pokeballs. The computation of each state is O(1), so the complexity of this solution is O(n^3). [cut] There is no obvious way to speed up this dp, because the transition of states is already done in O(1), and that's where dp optimization techniques usually cut the complexity. It's also useless to use some other definition of dp, since they will all take O(n^3) time to compute. But what we can do is to use the same trick used to solve the task Alien, from IOI 2016, or [problem:674C] in O(n log k) as [user:Radewoosh,2017-01-11] had described on his blog, and completely kick out a dimension from our dp! ...
int main(){ ios_base::sync_with_stdio(false);

Read more »

 
 
 
 
  • Vote: I like it
  • +243
  • Vote: I do not like it

 
 
 
 
3.
By oolimry, history, 10 months ago, In English
Codeforces Raif Round 1 Editorial [problem:1428A] ------------------ Setter: [user:bensonlzl,2020-10-17] Prepared by: [user:errorgorn,2020-10-17] <spoiler summary="Hint 1"> Consider when $x_1=x_2$ </spoiler> <spoiler summary="Hint 2"> Consider when $x_1 \ne x_2$ </spoiler> <spoiler summary="Solution"> We consider 2 cases. The first is that the starting and ending point lie on an axis-aligned line. In this case, we simply pull the box in 1 direction, and the time needed is the distance between the 2 points as we need 1 second to decrease the distance by 1. The second is that they do not lie on any axis-aligned line. Wabbit can pull the box horizontally (left or right depends on the relative values of $x_1$ and $x_2$) for $|x_1-x_2|$ seconds, take 2 seconds to move either above or below the box, then take another $|y_1-y_2|$ seconds to move the box to $(x_2,y_2)$. </spoiler> <spoiler summary="Code (C++)"> ```c++ #include <bits/stdc++.h> using namespace std; int main(){ ios_base::...
int main(){ ios_base::sync_with_stdio(false); cin.tie(0);

Read more »

 
 
 
 
  • Vote: I like it
  • +271
  • Vote: I do not like it

 
 
 
 
4.
By errorgorn, 5 months ago, In English
Codeforces Global Round 13 Editorial [problem:1491A] ------------------ Setter: [user:syksykCCC,2021-02-28] Prepared by: [user:syksykCCC,2021-02-28] <spoiler summary="Hint 1"> How can we find the largest $k$ such that the $k$-th smallest element of the array is $0$? </spoiler> <spoiler summary="Hint 2"> How can we maintain $k$? </spoiler> <spoiler summary="Solution"> Let's define $cnt$ to represent the number of 1s in the array. For the modifications, if $a_i$ is already $1$ now, then we let $cnt \gets cnt - 1$. Otherwise, let $cnt \gets cnt + 1$. For the querys, just compare $cnt$ with $k$. If $cnt \ge k$, the answer will be $1$. Otherwise, the answer will be $0$. The complexity : $O(n + q)$. </spoiler> <spoiler summary="Code (C++)"> ```c++ #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int n, q, a[N], cnt; int main() { scanf("%d%d",&n,&q); for(int i = 1; i <= n; ++i) { scanf("%d",a+i); cnt += a[i]; } while(q--) { int opt, x; ...
int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Read more »

 
 
 
 
  • Vote: I like it
  • +255
  • Vote: I do not like it

 
 
 
 
5.
By Harbour.Space, history, 11 days ago, In English
Harbour.Space Scholarship Contest 2021-2022 (Div. 1 + Div. 2) Editorial Hope you all enjoyed the problemset! Editorials to problems H and I are not ready yet, we will add them as soon as possible. We apologize for weak pretests and easy problems for top participants. By the way, solution authors did not necessarily prepare the problems. The solutions were chosen at random. **UPD.** Editorials for H and I are ready! Wish you all productive upsolving and high ratings! [problem:1553A] Idea: [user:bthero,2021-07-22] Preparation: [user:kefaa2,2021-07-22] <spoiler summary="Tutorial"> [tutorial:1553A] </spoiler> <spoiler summary="Solution (kefaa2)"> ~~~~~ #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { //freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(false); int tst; cin >> tst; while (tst--) { int n; cin >> n; cout << (n + 1) / 10 << '\n'; } } ~~~~~ </spoiler> [problem:1553B] Idea: [user:Errichto,2021-07-22] Preparation...
); ios_base::sync_with_stdio(false); int tst; cin >> tst; while (tst, int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

Read more »

 
 
 
 
  • Vote: I like it
  • +124
  • Vote: I do not like it

 
 
 
 
6.
By Na2a, history, 5 years ago, In English
ios_base::sync_with_stdio(0) receives runtime error! Hello, Codeforces! Yesterday, in CF Round 366 my friend [user:Birjik,2016-08-08] encountered a strange problem. His correct code was receiving Runtime Error in sample case. Take a look at these codes: [Runtime error](http://codeforces.com/contest/705/submission/19695431) [Accepted](http://codeforces.com/contest/705/submission/19725623) As you can notice, one code has these lines: ~~~~~ ios_base::sync_with_stdio(0); cin.tie(0); ~~~~~ Strange, isn't it? As I have understood, this happens because of an array called read. Renaming that array solves this problem. Long story short, using ios_base / cin.tie receives runtime error if we have a variable named read in our code. Be careful!
ios_base::sync_with_stdio(0) receives runtime error!, ios_base::sync_with_stdio(0) получает ошибку исполнения!, Long story short, using ios_base / cin.tie receives runtime error if we have a variable named read, ~~~~~ ios_base::sync_with_stdio(0); cin.tie(0); ~~~~~, Вкратце, использование ios_base / cin.tie получает ошибку исполнения если мы имеем переменную с

Read more »

 
 
 
 
  • Vote: I like it
  • +181
  • Vote: I do not like it

 
 
 
 
7.
By gmyu.michael, history, 7 weeks ago, In English
"Worse-to-best option", a different way to think about Slope Trick #### Background While I was learning the "Slope Trick", I could understand the examples in the tutorial but had a hard time solving related problems by myself. Maybe my brain just works differently. Along the way, I come up with a different way to think about this algorithm (and come to almost the same code). Here I would like to share how I think about it, which I call "Worse-to-best option", inspired by the "Buy Low Sell High" problem that I'll explain below. The Slope Trick is first explained by [user:zscoder,2021-06-12] [in this tutorial](https://codeforces.com/blog/entry/47821), and then further explained by [user:Kuroni,2021-06-12] in [this blog](https://codeforces.com/blog/entry/77298). I learned from [user:benq,2021-06-12]'s USACO Guide [here](https://usaco.guide/adv/slope). #### "Worse-to-best option" Instead of using the exact thinking process as above, this is how I'm thinking about it: This type of problem always gives you options to take certain actions thro...
int main() { debug = false; ios_base::sync_with_stdio(false); cin.tie(0);

Read more »

 
 
 
 
  • Vote: I like it
  • +103
  • Vote: I do not like it

 
 
 
 
8.
By Mantra7, history, 16 hours ago, In English
SPC — Final Contest : ) Editorial Link to contest : [SPC &mdash; Final Contest : )](https://codeforces.com/contestInvitation/ddb5bcb7cacfa3a53bb1e9e92f99927d51a6c095) ###[A. Fruits](https://codeforces.com/gym/338837/problem/A) Problem Author : [user:Cheata,2021-08-02] <spoiler summary="Tutorial"> [tutorial : 338837A] </spoiler> <spoiler summary="Solution"> ~~~~~ #include<bits/stdc++.h> using namespace std; #define int long long #define pub push_back #define pob pop_back #define ya cout<<"YES\n" #define na cout<<"NO\n" #define imp cout<<"Impossible\n" #define mod 998244353 void solve() { int n; cin>>n; string s; cin>>s; vector<int>a,o,b; for(int i=0;i<n;i++) { if(s[i]=='a') a.pub(i); if(s[i]=='b') b.pub(i); if(s[i]=='o') o.pub(i); } for(auto i :a) cout<<i+1<<" "; cout<<"\n"; for(auto i :b) cout<<i+1<<" "; cout<<"\n"; for(auto i :o) cout<<i+1<<" "; cout<<"\n"; } int32_t ma...
int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int T, int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);, int32_t main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int t=1; cin

Read more »

 
 
 
 
  • Vote: I like it
  • +14
  • Vote: I do not like it

 
 
 
 
9.
By deepanshujain088, history, 4 months ago, In English
Why is the ios_base::sync_with_stdio(false);cin.tie(NULL); not making speed of cin = scanf?? I have submitted the same algorithm with different input streams (cin and scanf) , I used ios_base::sync_with_stdio(false);cin.tie(NULL); with the cin and cout but still got a high difference in speeds? Can somebody explain?? The problem link that I submitted is this one-- https://codeforces.com/problemset/problem/368/B and my two differnt solutions are of 111556695 and 111568920 on Mar/31/2021.
Why is the ios_base::sync_with_stdio(false);cin.tie(NULL); not making speed of cin = scanf??, ios_base::sync_with_stdio(false);cin.tie(NULL); with the cin and cout but still got a high difference

Read more »

 
 
 
 
  • Vote: I like it
  • +17
  • Vote: I do not like it

 
 
 
 
10.
By awoo, history, 2 days ago, translation, In English
Educational Codeforces Round 112 Editorial [problem:1555A] Idea: [user:BledDest,2021-07-31] <spoiler summary="Tutorial"> [tutorial:1555A] </spoiler> <spoiler summary="Solution (Neon)"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n; cin >> n; cout << max(6LL, n + 1) / 2 * 5 << '\n'; } } ~~~~~ </spoiler> [problem:1555B] Idea: [user:adedalic,2021-07-31] <spoiler summary="Tutorial"> [tutorial:1555B] </spoiler> <spoiler summary="Solution (adedalic)"> ~~~~~ #include<bits/stdc++.h> using namespace std; #define fore(i, l, r) for(int i = int(l); i < int(r); i++) #define sz(a) int((a).size()) #define x first #define y second typedef long long li; typedef pair<int, int> pt; const int INF = int(1e9); int W, H; int x1, y1, x2, y2; int w, h; inline bool read() { if(!(cin >> W >> H)) return false; cin >> x1 >> y1 >> x2 >> y2; cin >> w >> h; return true; } inline void solv...
ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cout << fixed << setprecision(15);

Read more »

 
 
 
 
  • Vote: I like it
  • +86
  • Vote: I do not like it

 
 
 
 
11.
By JaySharma1048576, 4 weeks ago, In English
Codeforces Round #730 (Div. 2) Editorial #### [A: Exciting Bets](https://codeforces.com/contest/1543/problem/A) <spoiler summary="Hint 1"> $GCD(a,b)=GCD(a-b,b)$ if $a>b$ </spoiler> <spoiler summary="Hint 2"> $a-b$ does not change by applying any operation. However, $b$ can be changed arbitrarily. </spoiler> <spoiler summary="Tutorial"> If $a=b$, the fans can get an infinite amount of excitement, and we can achieve this by applying the first operation infinite times. Otherwise, the maximum excitement the fans can get is $g=\lvert a-b\rvert$ and the minimum number of moves required to achieve it is $min(a\bmod g,g-a\bmod g)$. <spoiler summary="Proof"> Without loss of generality, assume $a>b$ otherwise we can swap $a$ and $b$. We know that $GCD(a,b) = GCD(a-b,b)$. Notice that no matter how many times we apply any operation, the value of $a-b$ does not change. We can arbitrarily change the value of $b$ to a multiple of $a-b$ by applying the operations. In this way, we can achieve a $GCD$ equal to $a-b$. Now, ...
int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t

Read more »

 
 
 
 
  • Vote: I like it
  • +181
  • Vote: I do not like it