Problem Link: https://codeforces.me/contest/1417/problem/C
My solution: https://codeforces.me/contest/1417/submission/131124634
My solution is very similar (or almost same) to the editorial's solution: https://codeforces.me/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.
So I used arrays instead of vectors and got AC. (https://codeforces.me/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.
arrays are a little faster than vectors. try not to use second when you know exactly the number of elements for all the time