(This isn't supposed to be a serious post, but hopefully somebody finds it funny)
Intellegent: are you ok
Intellegent: i think you need some therapy man
Some of my submissions: (all of these were submitted in rated contests and AC'd, and none were intentionally written poorly)
My submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int n;
string one, two;
cin >> n >> one >> two;
vector<int> a(n/3+1);
vector<int> b(n/3);
vector<int> c(n/3);
a[0] = 0;
b[0] = (int)((int)(one[0] == 'A') + (int)(one[1] == 'A') + (int)(two[0] == 'A') >= 2);
c[0] = (int)((int)(one[0] == 'A') + (int)(two[0] == 'A') + (int)(two[1] == 'A') >= 2);
for(int i=1; i<=n/3; i++){
a[i] = a[i-1] + (int)((int)(one[3*(i-1)] == 'A') + (int)(one[3*(i-1)+1] == 'A') + (int)(one[3*(i-1)+2] == 'A') >= 2) + (int)((int)(two[3*(i-1)] == 'A') + (int)(two[3*(i-1)+1] == 'A') + (int)(two[3*(i-1)+2] == 'A') >= 2);
a[i] = max(a[i], b[i-1] + (int)((int)(two[3*(i-1)+1] == 'A') + (int)(two[3*(i-1)+2] == 'A') + (int)(one[3*(i-1)+2] == 'A') >= 2));
a[i] = max(a[i], c[i-1] + (int)((int)(two[3*(i-1)+2] == 'A') + (int)(one[3*(i-1)+1] == 'A') + (int)(one[3*(i-1)+2] == 'A') >= 2));
if(i<n/3){
b[i] = b[i-1] + (int)((int)(one[3*(i-1)+2] == 'A') + (int)(one[3*(i-1)+3] == 'A') + (int)(one[3*(i-1)+4] == 'A') >= 2) + (int)((int)(two[3*(i-1)+1] == 'A') + (int)(two[3*(i-1)+2] == 'A') + (int)(two[3*(i-1)+3] == 'A') >= 2);
c[i] = c[i-1] + (int)((int)(one[3*(i-1)+1] == 'A') + (int)(one[3*(i-1)+2] == 'A') + (int)(one[3*(i-1)+3] == 'A') >= 2) + (int)((int)(two[3*(i-1)+2] == 'A') + (int)(two[3*(i-1)+3] == 'A') + (int)(two[3*(i-1)+4] == 'A') >= 2);
b[i] = max(b[i], a[i] + (int)((int)(one[3*(i-1)+3] == 'A') + (int)(one[3*(i-1)+4] == 'A') + (int)(two[3*(i-1)+3] == 'A') >= 2));
c[i] = max(c[i], a[i] + (int)((int)(one[3*(i-1)+3] == 'A') + (int)(two[3*(i-1)+3] == 'A') + (int)(two[3*(i-1)+4] == 'A') >= 2));
}
}
cout << a[n/3] << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
My submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int n, k, cnt = 0, ans = 0;
cin >> n >> k;
int i=0;
for(; i<32; i++){if((n >> i) < k) break;}
int num = n & ((1 << i) - 1);
for(int j=0; j<i; j++) ans += ((n >> (j+1)) + (num & (1 << j) ? 1 : 0)) * (((num >> 1) & (~((1 << j) - 1))) + (num & (1 << j)));
cout << ans << '\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--) solve();
}
My submission:
#include <bits/stdc++.h>
using namespace std;
void solve(){
int l, r;
cin >> l >> r;
int x = (1 << __lg(l ^ r)), y = r & ~((x << 1) - 1);
cout << y + x << ' ' << y + x - 1 << ' ' << (y + x - 2 >= l ? y + x - 2 : y + x + 1) << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--) solve();
}
My submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int n, m;
cin >> n >> m;
vector<int> a(n), b(m), prea(n+1), sufa(n+1), preb(m+1), sufb(m+1), diffa(n/2+1), diffb(m/2+1);
for(int i=0; i<n; i++) cin >> a[i];
for(int i=0; i<m; i++) cin >> b[i];
int kmax = (max(n, m) >= 2*min(n, m) ? min(n, m) : max(n, m) - min(n, m) + 2*((2*min(n, m)-max(n, m))/3) + (int)((2*min(n, m)-max(n, m)) % 3 == 2));
cout << kmax << '\n';
sort(a.begin(), a.end()), sort(b.begin(), b.end());
for(int i=0; i<n/2; i++) prea[i+1] = prea[i] + a[i];
for(int i=0; i<m/2; i++) preb[i+1] = preb[i] + b[i];
sort(a.begin(), a.end(), greater<int>()), sort(b.begin(), b.end(), greater<int>());
for(int i=0; i<n/2; i++) sufa[i+1] = sufa[i] + a[i], diffa[i+1] = sufa[i+1] - prea[i+1];
for(int i=0; i<m/2; i++) sufb[i+1] = sufb[i] + b[i], diffb[i+1] = sufb[i+1] - preb[i+1];
int cura = 0, curb = 0;
for(int k=1; k<=kmax; k++){
if(diffa[cura+1] + diffb[curb] > diffa[cura] + diffb[curb+1]) cura++; else curb++;
while(cura > n-k){cura--; curb++;}
while(curb > m-k){curb--; cura++;}
cout << diffa[cura] + diffb[curb] << ' ';
}
cout << '\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--) solve();
}
If I can read it, surely it's fine... right? After all, that's all that really matters.
(I would seriously question the judgment of anybody who hires me to write code, ever.)
intellegent is right
he is very intellegent indeed
Intellegent is just salty that he has lost 10 TLE duels in a row to reirugan.
how he so fast whilst writing code like this
are you aware you can write code on multiple lines?
wait really?
Just to fan the flames, my main CF setup involves using an online C++ compiler and copy pasting my template from the notes section of my Discord profile.
you should try doing it from a phone with a bluetooth keyboard
if it makes you feel any better i also do that (minus the template part i dont even have one i just rewrite everything)
ok i just forgot i dont think i have a submission that doesnt use a regular for loop (i only use while and for each loops)
wait whats wrong with this i cant see it
check this
i think you need some therapy man
Even my solution for gerrymandering was very dirty
I think it's OK, just try to write looong expressions on multiple lines.
I think code style doesn't really matter much in CP.
For instance, my code uses long formulas, do not use spaces between most identifiers, use controversially bad macros like
#define F(i,x,y) for (int i=(x);i<=(y);i++)
, do not have senseful comments, and got lot of other traits that you would expect only in "badly styled" codes. However I still understand my code clearly. So I think as long as you don't find trouble reading your code, it's fine.(However, I think
#define int long long
isn't a good thing because it will sometimes increase the memory cost, and reduce the performance of your code especially on 32-bit judging machines. I once used it but stopped after getting couple MLEs on simple segment tree problems.)Just start using
#define int __int128
and soon you'll become Mindeveloped.My equations for quadratic regressions are like this. Now if someone see's it, then they are like "What is this? Are you Okay??"
Even Codeforces rejected it:
Any word length should be no more than 200
OMG
Please, say that you're not using this in any kind of source code in any project (even your own personal). Just imagine having a typo in formula in that kind of a mess.
If you're wondering whether it is possible to code such complicated formulas in a structured way, consider this:
It all seemed right to me after seeing 2053C 2057C first , but the code for Gerrymandering is just nasty.