제출 #857356

#제출 시각아이디문제언어결과실행 시간메모리
857356restingOvertaking (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
restrictions[i];
        int p1 = l1.size() - 1;
        int p2 = l2.size() - 1;
        int cur = 100000;
        while (p1 >= 0 || p2 >= 0) {
          //  cout<<"A: "<<p1<<","<<p2<<endl;
            if (p1 < 0) {
                nice.push_back(l2[p2]);
                cur = l2[p2].first;
                p2--;
            } else if (p2 < 0) {
                nice.push_back(l1[p1]);
                cur = l1[p1].first;
                p1--;
            } else if (l1[p1].second < l2[p2].second) {
                int a = l2[p2].first;
                while (l1[p1].second >= l2[p2].first) {
                    a = min(a, l1[p1].first);
                    p1--;
                } 
                l2[p2].first = a;
                    nice.push_back(l2[p2]);
                    cur = l2[p2].first;
                    p2--;
            } else {
                assert(l1[p1].second >= l2[p2].second);
                nice.push_back(l1[p1]);
                cur = l1[p1].first;
                p1--;
            }
            while (p1 >= 0 && l1[p1].first >= cur) p1--;
            while (p2 >= 0 && l2[p2].first >= cur) p2--;
        }
        swap(restriction, nice);
        //reverse(restriction.begin(), restriction.end());
        sort(restriction.begin(), restriction.end(), comp);
       // cout<<"restriction"<<endl;
  //  for(auto &x : restriction) cout<<x.first<<" "<<x.second<<endl;
    }


    return;
}

long long arrival_time(long long Y)
{
    auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
    if (yes >= 0 && yes <= restriction.size()) Y = max(Y, restriction[yes].second);
    return Y + x * l;
}

컴파일 시 표준 에러 (stderr) 메시지

overtaking.cpp:1:1: error: 'restrictions' does not name a type
    1 | restrictions[i];
      | ^~~~~~~~~~~~
overtaking.cpp:2:18: error: 'l1' was not declared in this scope; did you mean 'p1'?
    2 |         int p1 = l1.size() - 1;
      |                  ^~
      |                  p1
overtaking.cpp:3:18: error: 'l2' was not declared in this scope; did you mean 'p2'?
    3 |         int p2 = l2.size() - 1;
      |                  ^~
      |                  p2
overtaking.cpp:5:9: error: expected unqualified-id before 'while'
    5 |         while (p1 >= 0 || p2 >= 0) {
      |         ^~~~~
overtaking.cpp:34:13: error: expected constructor, destructor, or type conversion before '(' token
   34 |         swap(restriction, nice);
      |             ^
overtaking.cpp:36:13: error: expected constructor, destructor, or type conversion before '(' token
   36 |         sort(restriction.begin(), restriction.end(), comp);
      |             ^
overtaking.cpp:39:5: error: expected declaration before '}' token
   39 |     }
      |     ^
overtaking.cpp:42:5: error: expected unqualified-id before 'return'
   42 |     return;
      |     ^~~~~~
overtaking.cpp:43:1: error: expected declaration before '}' token
   43 | }
      | ^
overtaking.cpp: In function 'long long int arrival_time(long long int)':
overtaking.cpp:47:33: error: 'restriction' was not declared in this scope
   47 |     auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
      |                                 ^~~~~~~~~~~
overtaking.cpp:47:87: error: 'numeric_limits' was not declared in this scope
   47 |     auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
      |                                                                                       ^~~~~~~~~~~~~~
overtaking.cpp:47:102: error: expected primary-expression before 'long'
   47 |     auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
      |                                                                                                      ^~~~
overtaking.cpp:47:73: error: 'make_pair' was not declared in this scope
   47 |     auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
      |                                                                         ^~~~~~~~~
overtaking.cpp:47:21: error: 'upper_bound' was not declared in this scope
   47 |     auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
      |                     ^~~~~~~~~~~
overtaking.cpp:47:16: error: 'prev' was not declared in this scope
   47 |     auto yes = prev(upper_bound(restriction.begin(), restriction.end(), make_pair( Y, numeric_limits<long long>::max() )))- restriction.begin();
      |                ^~~~
overtaking.cpp:48:52: error: 'max' was not declared in this scope
   48 |     if (yes >= 0 && yes <= restriction.size()) Y = max(Y, restriction[yes].second);
      |                                                    ^~~
overtaking.cpp:49:16: error: 'x' was not declared in this scope
   49 |     return Y + x * l;
      |                ^
overtaking.cpp:49:20: error: 'l' was not declared in this scope
   49 |     return Y + x * l;
      |                    ^