Блог пользователя c-and-j

Автор c-and-j, история, 8 лет назад, По-английски

I have just submitted my solutions to 691D - Swaps in Permutation 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?

  • Проголосовать: нравится
  • -15
  • Проголосовать: не нравится

»
8 лет назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

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

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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