Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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...)

Source Link
vnp
  • 58.7k
  • 4
  • 55
  • 144

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...)

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /