Aoi_Hill's blog

By Aoi_Hill, history, 3 years ago, In English

These 2 solutions differ only in use of predefined max and #define max .

TLE code

AC code

Please provide detailed explanation to me, it took forever to debug. Thanks

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Aoi_Hill (previous revision, new revision, compare).

»
3 years ago, # |
Rev. 2   Vote: I like it +13 Vote: I do not like it

This is what happens with the macro:

(func(one) + ... < func(zero) + ... ? func(zero) + ... : func(one) + ...)

Either func(one) or func(zero) will be called twice, once for the comparison and once for the actual call.