coder_Aditya_404's blog

By coder_Aditya_404, history, 4 years ago, In English

How can we add new test case to the problem which may fail many of AC solutions?

EDIT 1: Low possibility for such test case but curious if its possible to do as above?

EDIT 2: Supersized to know this fact that even operations > 1e9 can be done in 2 seconds. Thanks

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

»
4 years ago, # |
  Vote: I like it +10 Vote: I do not like it

See testcase 24.

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Maybe you think the solution should get TLE. No it shouldn't, because compilers are clever enough to optimize such code.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    how in my ide compiler(g++) it shows TLE, can you explain or direct me to sources where i can find more about it? Thanks

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It's actually not about >1e9 operations per second. The compiler optimizes that for loop to a formula.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      What are you compiling options? Is -O2 set? Are there any other configuration differences?

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        How can i check compiling options, I don't know about it? btw i use VS code and "code runner" extension to run them in VS code.

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

          Do you have a build file or just compile manually?

          If it's the first case, look for launch.json or tasks.json file and you can edit your preferred command line arguments in args key.

          If it's the second case, you can optimize your code by passing some optimization flags during compilation.

          EDIT:

          For Code Runner, type @ext:formulahendry.code-runner in settings and click Edit in settings.json under Code-runner: Executor Map and you can edit your compilation command in cpp key.

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

            okay thanks, i am not use to these things but will try and report you back soon bro.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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