fofao_funk's blog

By fofao_funk, 8 years ago, In English

Hi all.

This week I solved two problems here on codeforces, both on C++. For my surprise, in those two problems, I received TLE as a verdict on really small testcases when using GNU C++11 as a language. The solutions for those tests were running pretty fast on my machine, so I decided to submit them with GNU C++14; surprisingly, those solutions were accepted, having really small execution time on the said tests.

Problem 1:

C++11, C++14

Problem 2:

C++11, C++14

What is the issue?

Appreciate the help!

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

»
8 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

You've used "%lld" in scanf,which is not supported by old version of mingw while using c++11 standard.So the mod you read might be an invaild number which caused TLE.But c++14 works with "%lld" well.

More information about c++14 Codeforces: С++14 is supported

There mentions works correctly to read-write long long both with %lld and %I64d

  • »
    »
    8 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    I think this is not the issue: I submitted another code with only the function g changed and it got accepted. Besides that, I've always used %lld with C++11 and it was never an issue.

    I also tested with %I64d and got TLE: 22112022