Submission #266596

#TimeUsernameProblemLanguageResultExecution timeMemory
266596dCodingGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define F0R(i,n) for(int i = 0; i < (n); i++) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define ll long long #define pb push_back long long findGap(int T, int N) { vector<ll> a; ll lo = 0, hi = 1e18; while(a.size() < N) { ll mn,mx; MinMax(lo,hi,mn,mx); if(mn == mx) { a.pb(mn); } else { a.pb(mn); a.pb(mx); hi = mx-1; lo = mn+1; assert(lo <= hi); } } ll ans = 0; sort(a.begin(),a.end()); FOR(i,1,n-1) ans = max(ans,a[i]-a[i-1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:20: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |     while(a.size() < N) {
      |           ~~~~~~~~~^~~
gap.cpp:15:22: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   15 |         MinMax(lo,hi,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:15:25: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   15 |         MinMax(lo,hi,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:26:13: error: 'n' was not declared in this scope
   26 |     FOR(i,1,n-1) ans = max(ans,a[i]-a[i-1]);
      |             ^
gap.cpp:5:43: note: in definition of macro 'FOR'
    5 | #define FOR(i,a,b) for(int i = (a); i <= (b); i++)
      |                                           ^