Submission #257096

#TimeUsernameProblemLanguageResultExecution timeMemory
257096EntityITGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(), (x).end() #define SZ(x) static_cast<int>((x).size()) template<class T, size_t D> struct vec : vector<vec<T, D - 1>> { template<class... Args> vec(size_t n = 0, Args... args) : vector<vec<T, D - 1>>(n, vec<T, D - 1>(args...)) {} }; template<class T> struct vec<T, 1> : vector<T> { template<class... Args> vec(Args... args) : vector<T>(args...) {} }; template<class T> inline bool Minimize(T& a, const T& b) { return a > b ? a = b, true : false; } template<class T> inline bool Maximize(T& a, const T& b) { return a < b ? a = b, true : false; } inline int Next(int i, int n) { return i == n - 1 ? 0 : i + 1; } inline int Prev(int i, int n) { return !i ? n - 1 : i - 1; } mt19937 rng(static_cast<uint32_t>(chrono::steady_clock::now().time_since_epoch().count())); #include "gap.h" int64_t findGap(int subtask, int n) { int64_t min_value, max_value, answer; MinMax(0, static_cast<int64_t>(1e18), &min_value, &max_value); auto max_a = max_value; int const magic = (max_value - min_value + n - 2) / (n - 1); answer = magic; for (int left_value = min_value + 1, right_value = min_value + magic, last_value = min_value; left_value <= max_a; left_value += magic, right_value += magic) { MinMax(left_value, right_value, &min_value, &max_value); if (~min_value) { Maximize(answer, min_value - last_value); last_value = max_value; } } return answer; }

Compilation message (stderr)

gap.cpp: In function 'int64_t findGap(int, int)':
gap.cpp:34:40: error: invalid conversion from 'int64_t* {aka long int*}' to 'long long int*' [-fpermissive]
  MinMax(0, static_cast<int64_t>(1e18), &min_value, &max_value);
                                        ^~~~~~~~~~
In file included from gap.cpp:29: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:34:52: error: invalid conversion from 'int64_t* {aka long int*}' to 'long long int*' [-fpermissive]
  MinMax(0, static_cast<int64_t>(1e18), &min_value, &max_value);
                                                    ^~~~~~~~~~
In file included from gap.cpp:29: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:43:35: error: invalid conversion from 'int64_t* {aka long int*}' to 'long long int*' [-fpermissive]
   MinMax(left_value, right_value, &min_value, &max_value);
                                   ^~~~~~~~~~
In file included from gap.cpp:29: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:43:47: error: invalid conversion from 'int64_t* {aka long int*}' to 'long long int*' [-fpermissive]
   MinMax(left_value, right_value, &min_value, &max_value);
                                               ^~~~~~~~~~
In file included from gap.cpp:29: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*);
      ^~~~~~