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

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

Hello. In yesterday's contest i was trying to solve its C problem but didn't finish it, so i have tried it again today but after implementing the idea that i had, i get time limit exceeded on test 3 (even though i implemented it with binary search, at least i think so). So here is what i tried: I reversed the sequence and then for every subsequence starting from index i and ending at size of vector for its maximal cost took maximal size of subsequences subsequence where its all members are >= of theirs indices+1-i; 196127370 Is the observation bad or did i implement it wrong, or both. Thanks for help.

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

»
21 месяц назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

In your binarys function, you're passing a copy of your vector which will significantly take a lot of time. Pass the address of the vector to your function instead.

»
21 месяц назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

$$$int binarys(vector<int>&v, int l, int x){ ... }$$$