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

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

Problem Link


bool canISaveMidMice(int mid, vector<int>a, int n) { // 0 1 2 3 4 5 6 7 8 9 10 //1 2 3 4 5 6 7 | 8 9 10 11 //n = 11 int mouse = 0, sum = 0, ind = a.size() - mid ;//11 - 4 = 6 while(ind < a.size()) { if(mouse >= a[ind])return false; sum += (n - a[ind]); mouse += (n - a[ind]); ind++; } return true; } void solve() { int n, k; cin>>n>>k; _vi v(k); for(auto &it : v)cin>>it; sort(_a(v)); int l = 0, h = k; int ans = 0; while(l <= h) { int mid = l - ((l - h)/2); if(canISaveMidMice(mid, v, n) == false) { h = mid - 1; } else { ans = max(ans, mid); // debug(ans); l = mid + 1; } } cout<<ans<<endl; return; }

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

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

Автор deydhananjoy5, история, 2 года назад, По-английски

I recently started doing Codeforces. Previously I used to solve problems on GeeksforGeeks and LeetCode. I find it very hard to maintain consistency in Codeforces. I think the main reason behind this is not having a daily target in Codeforces or something like Problem of The Day. Then I came to know about the site 'Codeforces Problem of The Day'. If you are also someone like me who is having difficulty maintaining consistency in Codeforces you can check this website where you will get one new problem everyday.

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

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