제출 #629891

#제출 시각아이디문제언어결과실행 시간메모리
629891hy_1Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include "gap.h" #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <cmath> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <unordered_map> #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:42:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   42 |  vector<ll> arr(n);
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from gap.cpp:24:
/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:38:12: error: expected primary-expression before 'long'
   38 | #define ll long long
      |            ^~~~
gap.cpp:42:9: note: in expansion of macro 'll'
   42 |  vector<ll> arr(n);
      |         ^~
gap.cpp:44:8: error: 'arr' was not declared in this scope
   44 |  while(arr.size() < n){
      |        ^~~
gap.cpp:46:18: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   46 |   MinMax(l , r , mn , mx);
      |                  ^~
      |                  |
      |                  long long int
In file included from gap.cpp:1:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:46:23: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   46 |   MinMax(l , r , mn , mx);
      |                       ^~
      |                       |
      |                       long long int
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:57:11: error: 'arr' was not declared in this scope
   57 |   ll y  = arr[i+1] - arr[i];
      |           ^~~