_maityamit's blog

By _maityamit, history, 3 months ago, In English

Hi Coders !!

Introduce LeetCode Wrapped (leetcodewrapped.info) — Get your Year Wise LeetCode Stats...

About LeetCode Wrapped:

LeetCodeWrapped is your go-to platform for a quick and comprehensive overview of your LeetCode journey over the years you are active. Simply enter your username, and get instant access to all your profile stats presented on a single screen. Our user-friendly interface makes it easy to visualize your performance. What's more, you can download your stats for offline use and share your achievements on social media directly from the platform. Experience the convenience of tracking and showcasing your coding accomplishments with LeetCodeWrapped – simplifying your leetcode journey...

What Stats You will get?

Card 0: Total No of Submissions, Active Days, Maximum Streak, Most Active Month, Most Active Day.

Card 1: Live Contest attended, Average Qns Solved in Contest, Maximum Rating, Highest Rank, Lowest Rank, Most Active Month.

So, why are guys waiting, let's check out the website and feel free to share your views. We are expecting your feedback. Whatever you feel, just share it with us so that we can improve...

Click Here to Know More


- Amit Maity

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

By _maityamit, history, 10 months ago, In English

Hi, my name is Amit Maity. After 10+ Months of practicing at Codeforces, I reached CYAN after Codeforces Round 885 (Div. 2). as fast-solving A & B.





I failed lots of times to reach CYAN by reaching nearly ~1400 due to sometimes small typo reason penalty, System Failed, Thoughts or Intuition got later or etc. I reached 1373 before 4 Months ago. But this 1374 to 1424 Journey takes 4 Months. Btw I enjoyed that process. It took 70+ contests.





Again, thanks to everyone.

Full text and comments »

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

By _maityamit, history, 14 months ago, In English

Hi, myself _maityamit

When I sign in to my account then it shows 140 days streak. As I maintained the streak every day.

As you can see my submitted code on 7/03/2023.


But I sign out then it shows 136 days. Even from any other browser, it shows 136 days. Although on the submission page it shows there is a submission on 7/03/2023.

Full text and comments »

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

By _maityamit, history, 15 months ago, In English

Hi, This side, Amit Maity.
Codeforces Round #847 (Div. 3) | Codeforces Round 847 (Div. 3)

1790A - Polycarp and the Day of Pi

Idea: _maityamit
Hola, You know the value of PI, right?
Then why not write this PI value as a string form PI = "314159265358979323846264338327950288419716939937510"
also in the question, they mentioned that it will be a maximum length of 30.
so, then just iterate over the given input and found the maximum match.

Submission: 190774194

void solve(){
   string pi = "314159265358979323846264338327950288419716939937510";
   string st;
   cin>>st;
   int i = 0;
   for(;i<st.length();i++){
   	 if(pi[i]!=st[i]) break;
   }
   cout<<i<<endl;
}


1790B - Taisia and Dice

Idea: _maityamit
They give nth term sum as s and n-1 th term sum as r. so, one term must be s-r.
After printing s-r we have now the n-1 place to fill, right? also we need to keep in mind that at every remaining n-1 box we need to fill at least one. so, why not fill that first by one and then increase by one up to the r not reaches zero?

Submission: 190785474

void solve(){
   int n,s,r;
   cin>>n>>s>>r;
   cout<<s-r<<" ";
   vector<int> arr(n-1,0);
   int idx = 0;
   while(r!=0){
   	  arr[idx]+=1;
   	  idx = (idx+1)%(n-1);
   	  r--;
   }
   for(auto it:arr) cout<<it<<" ";
   cout<<endl;
}


1790C - Premutation

Idea: _maityamit
As the question states that there will be given permutations but one element will be missing. You need to find the exact permutation that we can make. So, from this, we can say, that this question is like one after another, which means it depends one after another, sequence matter,s and some sequence is already given, we just need to connect.
So, we can apply here Topo Sort for calculating the final answer.
This question is generally based on one famous question Alien Dictionary.

Submission: 190843361

vector<int> helper(int V,vector<int> adj[]){
        vector<int> ans;
        vector<int> in(V,0);
        for(int i=1;i<V;i++){
            for(auto it:adj[i]) in[it]++;
        }
        queue<int> q;
        for(int i=1;i<V;i++) if(in[i]==0) q.push(i);
        while(q.size()!=0){
            int node = q.front();
            q.pop();
            ans.push_back(node);
            for(auto it:adj[node]){
                in[it]--;
                if(in[it]==0) q.push(it);
            }
        }
        return ans;
}
void solve()
   
   int n;
   cin>>n;
   vector<vector<int>> arr;
   vector<int> adj[n+1];
   for(int i=0;i<n;i++){
   	  vector<int> temp(n);
   	  for(int j=1;j<n;j++) cin>>temp[j];
   	  for(int i=2;i<n;i++){
   	  	adj[temp[i-1]].push_back(temp[i]);
	  }
   }
    vector<int> ans = helper(n+1,adj);
    for(auto it:ans) cout<<it<<" ";
    cout<<endl;
}


1790D - Matryoshkas

Idea: _maityamit
This question basically states that to find a set of consecutive positive integers, how many we can make this set?
This will contain consecutive no same element will exist.
So, why are you waiting just use Map and store all the elements, once again use Map not Unordered Map, here ordered matters, which means the array will be increasing, so.
And iterate over the map up to the map not empty and try to find the next consecutive element.

Submission: 190855892

void solve(){
   int n;
   cin>>n;
   map<int,int> mp;
   for(int i=0;i<n;i++){
   	  int temp; cin>>temp;
   	  mp[temp]++;
   }
   int cnt = 0;
   while(mp.size()!=0){
   	  int start = mp.begin()->first;
   	  while(mp.count(start)>0){
   	  	 mp[start]--;
   	  	 if(mp[start]==0) mp.erase(start);
   	  	 start++;
	  }
      cnt++;
   }
   cout<<cnt<<endl;
}

If you like, please upvote

Full text and comments »

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