Some cycles might be shaved off by making v
global, and/or replacing index increment/decrement with a pointer increment/decrement. For a smart compiler with necessary optimization turned on it would make no difference; do you know how do they compile the submissions?
As for the review, the code is OK except
using namespace std using namespace std, which is not OK.
Possible buffer overflow when number of integers exceeds \2ドル^{18}\$ (I know they promised, but for code review it is a red flag)
Misbehaving on a malformed input (see above...)
Some cycles might be shaved off by making v
global, and/or replacing index increment/decrement with a pointer increment/decrement. For a smart compiler with necessary optimization turned on it would make no difference; do you know how do they compile the submissions?
As for the review, the code is OK except
using namespace std, which is not OK.
Possible buffer overflow when number of integers exceeds \2ドル^{18}\$ (I know they promised, but for code review it is a red flag)
Misbehaving on a malformed input (see above...)
Some cycles might be shaved off by making v
global, and/or replacing index increment/decrement with a pointer increment/decrement. For a smart compiler with necessary optimization turned on it would make no difference; do you know how do they compile the submissions?
As for the review, the code is OK except
using namespace std, which is not OK.
Possible buffer overflow when number of integers exceeds \2ドル^{18}\$ (I know they promised, but for code review it is a red flag)
Misbehaving on a malformed input (see above...)
Some cycles might be shaved off by making v
global, and/or replacing index increment/decrement with a pointer increment/decrement. For a smart compiler with necessary optimization turned on it would make no difference; do you know how do they compile the submissions?
As for the review, the code is OK except
using namespace std, which is not OK.
Possible buffer overflow when number of integers exceeds \2ドル^{18}\$ (I know they promised, but for code review it is a red flag)
Misbehaving on a malformed input (see above...)