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

Автор practice_account, история, 6 лет назад, По-английски

Question — 1221D - Make The Fence Great Again My submission — 85248917 I have written a O(N) dp solution still it does not pass the 17th testcase. I have seen the editorial which also has a O(N) solution. Can anyone please tell me where am I doing the extra work here.

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

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

You needed fast io.

Added the two lines ios_base::sync_with_stdio(false); and cin.tie(NULL);

AC Submission: https://codeforces.me/contest/1221/submission/85249026

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

You TLE because you aren't using fast input. Add this line to the beginning of your main and it easily AC's:

ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);