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

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

Congrats to @Dominator069 for becoming India's first LGM. You have been an inspiration for so many of us like me, and my name is inspired from you.

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

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

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

Can anyone plese help me out what is the issue in my code, just couldnt understand why is it giving wrong answer for this, logic seems to be correct I guess

My submission https://mirror.codeforces.com/contest/2116/submission/336427692

The problem https://mirror.codeforces.com/contest/2116/problem/B

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

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

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

I noticed something weird today, so I was solving one problem and I m attaching the question link along with the solution which I used

https://mirror.codeforces.com/contest/1832/problem/C

include<bits/stdc++.h>

define ll long long

using namespace std; void fast_io() { ios::sync_with_stdio(false); cin.tie(0);
cout.tie(0); }

void dowork(ll int n, vector&arr){ if(count(arr.begin(),arr.end(),arr[0])==n){ cout<<1<<endl; return; } for(int i=0;i<arr.size()-1;i++){ if(arr[i]==arr[i+1]){ arr.erase(arr.begin()+i); i--; } } ll int cnt=2; ll int i=1; while(i<=n-2){ if(arr[i]>arr[i-1] && arr[i]>arr[i+1]){ cnt++; } else if(arr[i]<arr[i-1] && arr[i]<arr[i+1]){ cnt++; } i++;

}
cout<<cnt<<endl;
return;

}

int main(){ fast_io(); int t; cin>>t; while(t--){ ll int n; cin>>n; vectorarr(n); for(int i=0;i<n;i++){ cin>>arr[i]; } dowork(n,arr); } return 0; }

I know that I shoukdnt have used the delete function, since it can take the time complexity to O(N^2) when u delete that element and keep on shifting the remaining elements to the left, but I was tired so I just submitted it, and it got TLE on test 11 in C++ 23 Version, but surprisingly got accepted in C++ 20 Version, can anybody explain why did such thing happen?

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

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

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

Hi, I would like to get some advice on solving Geometry problems, more often than not I end up being clueless after reading the problem many times, I don't know how to improve upon this, looking for some help/content/advice pls

Same issue with Combinatorics as well for me

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

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

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

Could somebody give me some advice like how to become string at solving questions which are rated 1400+, I really suck at it. Thanks a lot

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

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