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:
Problem 2:
What is the issue?
Appreciate the help!
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
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