Блог пользователя delta_4d

Автор delta_4d, 10 лет назад, По-английски

For CF223C, I wrote a solution with segment tree, but the same code got different results with different C++ compiler.

7338858 in g++ got RTE, but the same code 7338855 in MSC++ got AC.

why does this happen, is it possible that g++ has some problems or the code has some serious flaws that g++ find out but MSC++ doesn't.

Теги g++
  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

or the code has some serious flaws that g++ find out but MSC++ doesn't

Yes it is. You're trying to declare function T(int a, int b, int c) with unknown return type, because it is wrapped into anonymous struct st.

--- struct {
+++ struct SegmentTree {

-- will fix this error

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

    thanks! it's fixed. I think I will always name a struct in the future.

    sorry, I still don't fully understand it. T(int,int,int) is the constructor in struct T. what difference does anonymous struct make, why RTE though?