Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

NoCommander's blog

By NoCommander, history, 16 months ago, In English

217414890

217414841

The above two codes only differ in the submission language.But one gets Accepted,the other gets Wrong answer on test 1.

wrong output format Expected integer, but "?" found (test case 1)

In C++14,it did f(1, n) first and did cout << "! " next.

In C++17,it did cout << "! " first and did f(1, n) next.

Before C++17, the order of << was not specified.

update:Thanks to balalaika,more clearly,A << B << C,A,B and C can be evaluated in any order.

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

»
16 months ago, # |
  Vote: I like it +3 Vote: I do not like it

orz.

»
16 months ago, # |
  Vote: I like it +16 Vote: I do not like it

Some stupid correction:

Order of << was sure always specified in all standards (A << B << C is always (A << B) << C and nothing else), but A , B and C before C++17 can be evaluated in any order.

In C++17 there is line that clarifies that A must be fully evaluated before start of evaluation of B (and so about A << B and C). https://timsong-cpp.github.io/cppwp/n4659/expr.shift#4