c1ph3rx's blog

By c1ph3rx, history, 21 month(s) ago, In English

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.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

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 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

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