Hello ,
what do you do when you just feel depressed or you just wanna set without doing something , i've been practicing alot , still solving up to 3 questions only in div 3,4 ...
# | User | Rating |
---|---|---|
1 | jiangly | 3846 |
2 | tourist | 3799 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3590 |
6 | Ormlis | 3533 |
7 | Benq | 3468 |
8 | Radewoosh | 3463 |
9 | ecnerwala | 3451 |
9 | Um_nik | 3451 |
# | User | Contrib. |
---|---|---|
1 | cry | 165 |
2 | -is-this-fft- | 161 |
3 | Qingyu | 160 |
4 | atcoder_official | 157 |
5 | Dominater069 | 156 |
6 | adamant | 154 |
7 | Um_nik | 151 |
7 | djm03178 | 151 |
9 | luogu_official | 149 |
10 | awoo | 147 |
Hello ,
what do you do when you just feel depressed or you just wanna set without doing something , i've been practicing alot , still solving up to 3 questions only in div 3,4 ...
Hello codeforces ,
i'm brand new to dfs and i have spend like 4 hours trying to find a solution for The Tag Game problem.
what i have tried:
bob wants to maxmizes the solution , alice wants to minimize , so bob need to reach the deepest node , when bob reaches it alice will move to catch him , but bob has the choice to stay in the node (each of them has that option but i guess only bob will use it) i can't handle this choice of staying as a move, this is my code:
const int N_=10e5+6,M=2*10e5+6;
const int NOT_VISITED = 0 , IN_PROGRESS = 1 , VISITED = 2;
int m,n,u,v;
vector<int> adj[N_];
vector<pair<int,int>> dxdy = {{-1,0},{1,0},{0,1},{0,-1}};
// vector<vector<bool>> vis;
bool vis[N_];
int c;
// bool isValid(int x , int y , vector<STR>&grid){
// if(x < 0 || x > n-1 || y <0 || y>m-1) return false;
// if(vis[x][y] || grid[x][y] == '#') return false;
// return true;
// }
int md = 0 , fn=0;
void dfs(int u,int depth){
vis[u] =true;
if(depth > md){
md = depth;
fn = u;
}
c++;
for(auto x : adj[u]){
if(!vis[x]){
dfs(x,depth+1);
}
}
}
void solve()
{
cin >> n>>m;
for(int x = 0 ;x < n-1 ; x++){
cin >>u >>v;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs(m,0);
int ans = md;
memset(vis,false,sizeof(vis));
md=0;
c=0;
dfs(1,0);
c-=2;
cout << ans+c+md;
}
Hello CF , First thing first , happy new year , May this year bring you health , happiness and successes in all you do !
i have struggled to understand Palindrome Pairs solution "in terms of bitmasks" , as i'm newbie.
i didn't thought about the iterative solution as it will be o(n^2) which will case TLE ,so i was trying to get a better solution and i wasn't able to , so i saw the solution which is something like this:
int main()
{
FastIO;
ll n ;cin >>n;
map<ll,ll> mp;
ll ans = 0;
while(n--)
{
STR s;cin>>s;
ll m = 0;
for(auto x : s)
{
ll v = x-'a';
m ^= (1 << v);
}
ans += mp[m];
for(int x = 0 ; x < 26 ; x++)
{
m ^= (1 << x);
ans += mp[m];
m ^= (1 << x);
}
mp[m]++;
}
cout << ans;
}
i don't get it , i mean i know to check if a string is a Palindrome or not we get it's mask and check it's power of 2 or not by XOR'ing the values of each char ....help
Hello codeforces, as i have learned a new datastructure , i would like to solve some problems on it , so suggest some problems i can solve on binary search trees.
Hello , Recently i was trying to solve this problem 932B which was kinda tricky as it requires prefix sum to avoid TLE , it required 2d-prefix sum , so what's that and why i could need it , suggest some problems to get familiar with it.
Hello , suggest any problem (or set of problems) that can be solved using recursion and it's grid based , problems like go from s to e , or find the shortest path .... etc
Hello codeforces , a few days ago i started learning more about recursion , and i indeed tried to solve some very basic problems on it , however , when it comes to tricky problems i cannot think how to implement a recursive function to solve the problem , another thing makes me wondring is when should i implement a recursive function and when i use the iterative function, so if anyone has some ideas about the previous questions , write it below.
thanks.
Hello , when solving problems on binary search, i solve them because i know that i'm solving problems on Binary search topic , but if i come to a problem statement i don't know how or even if I should use binary search or not ... so my question is , how to make sure you're solving a binary search problem?
Hello codeforces , i just have learned the backtracking technique , i want to practice and put my hands on , i want some biggener freindly problems
Hello , Could some one please suggest a set of problems i can solve to put my hands on the "Coordinates Compression" technique ?
Name |
---|