Let's discuss the various approaches used to get the maximum points. :)
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Let's discuss the various approaches used to get the maximum points. :)
Hello everybody!
I am a Computer Science undergraduate currently in my 2nd year and want to develop some projects. I know other developments like android dev or web dev, but I want to do a project related to cp in which I can apply some algorithms.
I searched on the internet but found projects like sudoku solver and pathfinder that are too common nowadays, and It would be great if you can share your ideas and previous projects related to CP... I would be too grateful to you!
Thanks...
Many times we are stuck in a problem and don't know the edge case in which the programme fails, specially during long challenges or monthly challenges we think our solution is correct but it gives WA on submition. So, I'm sharing my idea to stress test your code with a bruteforce or an unoptimized solution without using bash.
So, basically what you have to do is first write a brute force solution and put it in the "Solve" function and put the optimized ones in the second one. change the function and return value according to the question also if you want then make the test generating while loop infinite also adjust the array size according to the constraints of your bruteforce solution.
I would recommend you to use Code-blocks or VS Code for this purpose.
Code begins:
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int MOD = 1e9 + 7;
#define show(arr) { for (auto x: arr) cout << x << " "; cout << '\n'; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int randNo(int lower_limit, int upper_limit){
return lower_limit + rng()%(upper_limit-lower_limit);
}
int solve(int arr[], int n) {
int ans = 0 ;
//write here your optimed code with low complexity
return ans;
}
int solve2(int arr[], int n) {
int ans = 0 ;
//write here your brute force solution
return ans;
}
int32_t main() {
int testCases = 1000000;
while(testCases--){
//generating n
int n = randNo(1,100);
//To generate a random array
int a[n];
for(int i=0;i<n;i++) a[i] = randNo(1,N);
int naive_ans = solve2(a,n);
int optimised_ans = solve(a,n);
if(naive_ans == optimised_ans) cout << "YES\n";
else{
cout << "NO\n";
cout << n << '\n';
show(a);
cout << naive_ans << '\n';
cout << optimised_ans << '\n';
break;
}
}
}
Any suggestion/Edits or questions are welcomed.! :) If you are downvoting please comment the reason so that I can improve..
Edit 1: Don't use rand(): a guide to random number generators in C++ Please read this once to generate random numbers efficiently thanks GLAYS .
Edit 2: Updated rand() with mt19937 rng().
Hi,
From the previous 5 months I gave about 40+ contest and I am still stucked at Expert everytime I hit 1800+ rating it falls down again and again....
Please suggest me some strategy to become a Candidate Master on CF.
Thanks in advance...
UPD 1: Finally after 7 weeks of this blog I became CM :)
many of my friends were asking for suggestion. so, here are the few of them.!
UPD 2: After continuous grinding of about 7 months of last update I finally became Orange :)
I am confused about how to get sum from a node y to its ancestor x using a segment tree. there is query of 10^5 order consists of update and find sum of the nodes between them.!
Name |
---|