제출 #629893

#제출 시각아이디문제언어결과실행 시간메모리
629893hy_1Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> #define ll long long long long findGap(int T, int N){ ll n = N; vector<ll> arr(n); ll l =1 , r = 1e18; while(arr.size() < n){ ll mn , mx; MinMax(l , r , &mn , &mx); arr.push_back(mn); if(mn != mx){ arr.push_back(mx); } l += 1; r -= 1; } ll ans = 0; for(int i =0; i<n-1; i++){ ll y = arr[i+1] - arr[i]; // ans = max(ans , y); if(y > ans) ans = y; } return ans; }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    9 |  vector<ll> arr(n);
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
gap.cpp:5:12: error: expected primary-expression before 'long'
    5 | #define ll long long
      |            ^~~~
gap.cpp:9:9: note: in expansion of macro 'll'
    9 |  vector<ll> arr(n);
      |         ^~
gap.cpp:11:8: error: 'arr' was not declared in this scope
   11 |  while(arr.size() < n){
      |        ^~~
gap.cpp:24:11: error: 'arr' was not declared in this scope
   24 |   ll y  = arr[i+1] - arr[i];
      |           ^~~