Блог пользователя mainnahihoo

Автор mainnahihoo, история, 3 месяца назад, По-английски

why the recent rounds have too much acceptance ration like see yesterday 1076 div 3

again see this div 2 1075

see again 1073 div 2

i don't know the valid reason but seeing that much correct submission make me to post this

Полный текст и комментарии »

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

Автор mainnahihoo, история, 7 месяцев назад, По-английски

Problem is Link

what my approach is -> i had written a brute force recurion simply trying all possible results i can make and storing the results in pair at the end i can see what the max score achieved by 1st person and the 2nd person

problem is getting wrong answer in large test case i am not able to debug after this .

please helppppppppppppppp

pair<int,int> mpl[2500][2500][2];
int x=0;
pair<int,int> rec(int l,int r,int flag,vector<int>&vec){
    if(l>r) {
        // cout<<"!!!!!!!!!!!!!"<<endl;
        return {0,0};
    }
    if(mpl[l][r][flag].first!=-1 && mpl[l][r][flag].second!=-1) return mpl[l][r][flag];
    x++;
    // cout<<"call for "<<l<<" "<<r<<" "<<flag<<endl;
    pair<int,int> ans={0,0};
    pair<int,int>left,right;
     if(flag){
        pair<int,int> left=rec(l+1,r,!flag,vec);
        pair<int,int> right=rec(l,r-1,!flag,vec);
        left.first+=vec[l];
        right.first+=vec[r];
        ans = (left.first > right.first) ? left : right;
    }
    else{ 
        pair<int,int> left=rec(l+1,r,!flag,vec);
        pair<int,int> right=rec(l,r-1,!flag,vec);
        left.second+=vec[l];
        right.second+=vec[r];
        ans = (left.second > right.second) ? left : right;
    }
    mpl[l][r][flag]=ans;
    return mpl[l][r][flag];
}
void solve() {
    // executing code from here 
    int t=1;
    while (t--) {
        int n;
        cin >> n;
        vi vec(n);
        for (int i = 0; i < n; i++) cin >> vec[i];
        // cout<<a.first<<" "<<a.second<<endl;
        // dbg(x);
        for(int i=0;i<2500;i++){
            for(int j=0;j<2500;j++){
                for(int k=0;k<2;k++){
                    mpl[i][j][k]={-1,-1};
                }
            }
        }
        pair<int,int>a=rec(0,n-1,1,vec);
        cout<<a.first<<endl;
    }
}

Полный текст и комментарии »

  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится

Автор mainnahihoo, история, 7 месяцев назад, По-английски

this problem is minimal task Link can be solved by dp, i am using bfs or djikstra u can say , so i made a priority_queue and when first time when my string will be having the size of 2*n-1 means i had reached to end so this will be the answer lexicographically

see the code i am getting TLE no wrong answer i think worst complexity will be O(N^2) ,Please help


struct cmp { bool operator()(const pair<pair<int,int>,string> &x, const pair<pair<int,int>,string> &y) const { return x.second > y.second ; } }; int check(int i,int j,int n){ return i>=0 && j>=0 && i<n && j<n; } string ans; vector<pair<int,int>>dir={{1,0},{0,1}}; string bfs(int i,int j,vector<vector<char>>&vec,vector<vector<int>>&vis,int n){ priority_queue<pair<pair<int,int>,string>,vector<pair<pair<int,int>,string>>,cmp>pq; string s; s+=vec[i][j]; pq.push({{i,j},s}); while(!pq.empty()){ auto it=pq.top();pq.pop(); string temp=it.second; if(it.second.size()==(n*2 - 1)){ return it.second; } for(auto &i:dir){ int new_x=it.first.first+i.first; int new_y=it.first.second+i.second; if(check(new_x,new_y,n) && vis[new_x][new_y]==-1){ vis[new_x][new_y]=1; pq.push({{new_x,new_y},temp+vec[new_x][new_y]}); } } } } void solve() { // executing code from here int t=1; while (t--) { int n; cin >> n; vector<vector<char>> vec(n,vector<char>(n,'.')); vector<vector<int>> vis(n,vector<int>(n,-1)); for (int i = 0; i < n; i++){ for(int j=0;j<n;j++){ cin>>vec[i][j]; } } cout<<bfs(0,0,vec,vis,n)<<endl; } } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // sieve(); solve(); return 0; }

Полный текст и комментарии »

  • Проголосовать: нравится
  • -25
  • Проголосовать: не нравится

Автор mainnahihoo, история, 9 месяцев назад, По-английски

problem atcoder problem

int dp[(1<<20)];
// int cnt=0;
int rec(int mask,string &s,int n){
	// cout<<"call for "<<mask<<endl;
	if(mask==(1<<n)-1)return 1;
	if(dp[mask]!=-1)return dp[mask];
	int x=0;
	for(int i=0;i<n;i++){
		if(!(mask&(1<<i)) && s[mask|(1<<i)]=='0'){
			x|=rec(mask|(1<<i),s,n);
		}
	}
	// cnt++;
	return dp[mask]=x;
}

void solve() {
	// executing code from here 
	int t;
	cin >> t;
	while (t--) {
		int n;cin >> n;string s;cin>>s;
		memset(dp,-1,sizeof(dp));
		s='0'+s;
		if(rec(0,s,n))cy;
		else cn;
	}
}

I am getting TLE why after dp time complexity should be 2^n*n not n!*n

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор mainnahihoo, история, 10 месяцев назад, По-английски

this is kind of suggestion when ever some body get skipped solution make it's rating -x where x is the current rating of the user then i think the cheating rate will get down , upvote if you like and else downvote

Полный текст и комментарии »

  • Проголосовать: нравится
  • -16
  • Проголосовать: не нравится

Автор mainnahihoo, история, 12 месяцев назад, По-английски

Hello respected coders , please tell me approach to solve this at coder question LOGICAL FILLING firstly i was thinking that this question was dp but atleast we need two states for dp and that will be a TLE , how to approach this please help , and 4th question of atcoder is a barrier for me how to cross that .

HELP

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор mainnahihoo, история, 13 месяцев назад, По-английски

Like in this days i was observing that the div 2 b question language they are making harder that is irrelevant , like see this question 2078B - Vicious Labyrinth and this one also 2075C - Two Colors , like in both question i was not able to know the question propelry how i can get to the correct approach please tell like in this question 2078B - Vicious Labyrinth , there is no mention of how the neighbour is spreading so everybody thinks like just take the max of sum of k+1 element , please reply don't judge me based on my rating please , and sorry for poor english

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор mainnahihoo, история, 13 месяцев назад, По-английски

in recent contest div 2 that was yesterday 1008 round i was not able to solve single one question i don;t know what was going wrong i had solved 400 problem on codechef please help help

Полный текст и комментарии »

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

Автор mainnahihoo, история, 14 месяцев назад, По-английски

I think instead of talkig about these cheaters we should try to help codeforces team to make a system no cheat code get accepeted and no ai code get accepted , I think making ML model in this will really helps but the issue is it's accuracy is so high

Полный текст и комментарии »

  • Проголосовать: нравится
  • -4
  • Проголосовать: не нравится

Автор mainnahihoo, история, 14 месяцев назад, По-английски

Hello, Competitive Programmers!

I've been practicing on Codeforces for a while now, but I feel like my rating is stuck. I'm reaching out to all the young and talented coders here—how do you approach problem-solving to improve your rating consistently?

I would love to hear your insights on:

Training Strategies: How do you practice? Do you follow a schedule or focus on particular topics?

Problem Selection: Do you solve problems based on difficulty, rating, or specific tags?

Contests: How do you prepare for contests, and what is your mindset during live contests?

Resources: What books, websites, or tutorials helped you the most?

Debugging and Learning from Mistakes: How do you analyze and learn from your wrong submissions?

Mental Approach: How do you stay motivated and avoid frustration when stuck at a certain rating?

I’d appreciate any tips, personal experiences, or advice you can share! Let’s help each other grow in competitive programming.

Looking forward to your responses!

Happy Coding!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится