제출 #668243

#제출 시각아이디문제언어결과실행 시간메모리
668243birthdaycakeGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int T, int N){ long long l = 0, r = 0, mn = 0, mx = 0; MinMax(1, 1000000000000000000, mn, mx); l = mn; r = mx; long long sz = (r - l + 1) / (N - 1); vector<pair<int,int>>d; for(int j = l; j <= r; j += sz+1){ MinMax(j, j + sz, mn, mx); d.push_back({mn, mz}); } long long ans = (r - l + 1) / (N - 1); mn = d[0].first; mx = d[0].second; for(int i = 1; i < d.size(); i++){ if(mx != -1 && d[i].first != -1){ ans = max(ans, d[i].first - mx); mn = d[i].first; mx = d[i].second; } } return ans; }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:8:36: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    8 |     MinMax(1, 1000000000000000000, mn, mx);
      |                                    ^~
      |                                    |
      |                                    long long int
In file included from gap.cpp:2:
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:8:40: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    8 |     MinMax(1, 1000000000000000000, mn, mx);
      |                                        ^~
      |                                        |
      |                                        long long int
In file included from gap.cpp:2:
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:13:27: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |         MinMax(j, j + sz, mn, mx);
      |                           ^~
      |                           |
      |                           long long int
In file included from gap.cpp:2:
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:13:31: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |         MinMax(j, j + sz, mn, mx);
      |                               ^~
      |                               |
      |                               long long int
In file included from gap.cpp:2:
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:14:26: error: 'mz' was not declared in this scope; did you mean 'sz'?
   14 |         d.push_back({mn, mz});
      |                          ^~
      |                          sz
gap.cpp:14:29: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   14 |         d.push_back({mn, mz});
      |                             ^
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:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
gap.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 1; i < d.size(); i++){
      |                    ~~^~~~~~~~~~