제출 #338620

#제출 시각아이디문제언어결과실행 시간메모리
338620NicolaAbusaad2014Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
/** * Prof.Nicola **/ #include "gap.h" #include <bits/stdc++.h> using namespace std; template<class T>void re(T&x){cin>>x;} template<class T1,class T2> void re(pair<T1,T2>&x){re(x.first);re(x.second);} template<class T>void re(vector<T>&x){for(long i=0;i<x.size();i++){re(x[i]);}} template<class T>void re(deque<T>&x){for(long i=0;i<x.size();i++){re(x[i]);}} template<class T1,class T2> pair<T1,T2> mp(T1&x,T2&z){return make_pair(x,z);} long n; set<long long>s; set<long long>::iterator a,b; void solve(long long l,long long r) { long long mx,mn; MinMax(l, r, mn, mx); if(mn==-1){ return; } if(s.size()==n){ return; } s.insert(mn); s.insert(mx); if(mn+1>=mx){ return; } if(mn+3>=mx){ solve(mn+1,mx-1); return; } solve(mn+1,((mx+mn)/2)); solve(((mx+mn)/2)+1,mx-1); return; } long long findGap(int T, int N) { n=N; solve(0,1e18); a=s.begin(); b=s.begin(); b++; long long ans=0; for(long i=1;i<s.size();i++){ ans=max(ans,*b-*a); a++; b++; } return ans; }

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

gap.cpp: In function 'void solve(long long int, long long int)':
gap.cpp:19:18: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   19 |     MinMax(l, r, mn, mx);
      |                  ^~
      |                  |
      |                  long long int
In file included from gap.cpp:4:
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:19:22: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   19 |     MinMax(l, r, mn, mx);
      |                      ^~
      |                      |
      |                      long long int
In file included from gap.cpp:4:
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:23:16: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long int' [-Wsign-compare]
   23 |     if(s.size()==n){
      |        ~~~~~~~~^~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:47:19: warning: comparison of integer expressions of different signedness: 'long int' and 'std::set<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(long i=1;i<s.size();i++){
      |                  ~^~~~~~~~~