Submission #112062

#TimeUsernameProblemLanguageResultExecution timeMemory
112062Eug1enaGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; using lint = long long; const lint INF = 1e18; lint findGap(int T, int N){ if(T == 1){ vector<lint> left{-INF}, right{INF + 100}; while(left.back() + 2 <= right.back()){ lint l, r; MinMax(left.back() + 1, right.back() - 1, l, r); if(l == -1){ break; } left.push_back(l); right.push_back(r); } vector<lint> a; for(int i = 1; i < left.size(); i++){ a.push_back(left[i]); } for(int i = int(right.size()) - 1; i >= 1; i--){ a.push_back(right[i]); } lint ans = 0; for(int i = 1; i < a.size(); i++){ ans = max(ans, a[i] - a[i - 1]); } return ans; }else{ return -1; } }

Compilation message (stderr)

gap.cpp: In function 'lint findGap(int, int)':
gap.cpp:12:59: error: invalid conversion from 'lint {aka long long int}' to 'long long int*' [-fpermissive]
             MinMax(left.back() + 1, right.back() - 1, l, r);
                                                           ^
In file included from gap.cpp:1:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:12:59: error: invalid conversion from 'lint {aka long long int}' to 'long long int*' [-fpermissive]
             MinMax(left.back() + 1, right.back() - 1, l, r);
                                                           ^
In file included from gap.cpp:1:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:20:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < left.size(); i++){
                        ~~^~~~~~~~~~~~~
gap.cpp:27:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < a.size(); i++){
                        ~~^~~~~~~~~~