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

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

Problem Link: https://mirror.codeforces.com/contest/1417/problem/C

My solution: https://mirror.codeforces.com/contest/1417/submission/131124634

My solution is very similar (or almost same) to the editorial's solution: https://mirror.codeforces.com/blog/entry/83036 The only difference I noticed is that I'm using cin/cout instead of scanf/printf and I'm using vectors instead of arrays. Also, I'm using #define int long long.

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

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

So I used arrays instead of vectors and got AC. (https://mirror.codeforces.com/contest/1417/submission/131135523).

So apparently Arrays are almost twice as fast as Vectors. Can anyone confirm? I've been using vectors all the time now without ever realising how slow it is. Time to switch perhaps.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    arrays are a little faster than vectors. try not to use second when you know exactly the number of elements for all the time