c-and-j's blog

By c-and-j, history, 8 years ago, In English

I have just submitted my solutions to 691D - Свопы в перестановке from Educational Codeforces Round 14. They are 19226396, 19226642 and 19226815.

Test #2 is

1 1
1
1 1

I ran my solutions on my machine, compiled with standard command line (g++.exe -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -lm -s -x c++ -Wl,--stack=268435456 -O2 -o D.exe D.cpp). They all output 1. However, they all got RTE on Codeforces online judging system.

Is there a bug on Codeforces or are my solutions wrong?

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

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

I am getting a segmentation fault while running your first submission on Test #2. Please check your program for memory corruption.

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

    I don't think my algorithm is wrong because I reran all of my submissions on both Ubuntu and Windows but found nothing wrong.

    $ g++ -std=c++11 -Wall -O2 -o D D.cpp && echo 1 1 1 1 1|./D
    D.cpp: In function ‘int main()’:
    D.cpp:49:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < vi.size(); i++)
                         ^
    1