This is my subimssion during the contest.
This is my submission during practice.
Only change is around line number 61.
I changed
vector<int> tnums;
for(int i=0; i<n; ++i)
tnums.push_back(nums[i]);
to
vector<int> tnums(n);
for(int i=0; i<n; ++i)
tnums[i] = nums[i];
and it turned TLE to AC.
Is vector.push_back() that slow ?
The version without push_back() passes within time limits even with cin,cout instead of scanf,printf !
In short,
using push_back, scanf and printf gives TLE.
not using push_back and using cin and cout gives AC.
So push_back hurts your code’s performance more than cin,cout ?