ALT__'s blog

By ALT__, history, 3 years ago, In English

Problem Link: https://codeforces.net/contest/1417/problem/C

My solution: https://codeforces.net/contest/1417/submission/131124634

My solution is very similar (or almost same) to the editorial's solution: https://codeforces.net/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.

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

So I used arrays instead of vectors and got AC. (https://codeforces.net/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 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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