제출 #587853

#제출 시각아이디문제언어결과실행 시간메모리
587853xynexGap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; #define ll long long #define dl double long #define ull unsigned long long #define pr pair #define vt vector #define ff first #define ss second #define mp make_pair #define sz(a) (int)a.size() #define pb push_back #define pf push_front #define popB pop_back #define popF pop_front #define bit_count __builtin_popcount #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sp(x) fixed << setprecision(x) template<typename T> T get_rand(T l, T r) { random_device rd; mt19937 gen(rd()); return uniform_int_distribution<T>(l, r)(gen); } template<typename T> T lcm(T a, T b) { return a * (b / __gcd(a, b)); } template<class A> void read(vt<A>& v); template<class A, size_t S> void read(array<A, S>& a); template<class T> void read(T& x) { cin >> x; } void read(double& d) { string t; read(t); d = stod(t); } void read(long double& d) { string t; read(t); d = stold(t); } template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); } template<class A> void read(vt<A>& x) { for (auto& a : x) read(a); } template<class A, size_t S> void read(array<A, S>& x) { for (auto& a : x) read(a); } string to_string(char c) { return string(1, c); } string to_string(bool b) { return b ? "true" : "false"; } string to_string(const char* s) { return string(s); } string to_string(string s) { return s; } string to_string(vt<bool> v) { string res; for (int i = 0; i < sz(v); ++i) res += char('0' + v[i]); return res; } template<size_t S> string to_string(bitset<S> b) { string res; for (int i = 0; i < S; ++i) res += char('0' + b[i]); return res; } template<class T> string to_string(T v) { bool f = 1; string res; for (auto x : v) { if (!f) res += ' '; f = 0; res += to_string(x); } return res; } template<class A> void write(A x) { cout << to_string(x); } template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); } void print() { write("\n"); } template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); } void freop(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } const int MOD = 1e9 + 7; const int N = 8e6 + 5; const ll INF = 9e18; const int M = 3e3 + 5; const dl pi = acos(-1); const dl eps = 1e-12; const int sq = 700; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; /* ll vs int*/ long long findGap(int T,int N) { ll f = 0, err = 0; MinMax(0ll, INF, f, err); ll s = 0; MinMax(f + 1, INF, s, err); ll mxGap = s - f; ll last = s; while(1) { ll cur = 0; ll next = 0; MinMax(last + 1, last + mxGap, cur, next); if(cur == -1) { MinMax(last + 1, INF, cur, next); if(cur == -1) break; mxGap = cur - last; last = cur; } else { last = next; } } // print(f, s); return mxGap; } /*int main() { read(n); for(int i = 1; i <= n; ++i) { read(A[i]); } print(findGap(1, n)); print(call_count); return 0; }*/

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:73:20: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   73 |   MinMax(0ll, INF, f, err);
      |                    ^
      |                    |
      |                    long long int
In file included from gap.cpp:3:
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:73:23: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   73 |   MinMax(0ll, INF, f, err);
      |                       ^~~
      |                       |
      |                       long long int
In file included from gap.cpp:3:
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:75:22: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   75 |   MinMax(f + 1, INF, s, err);
      |                      ^
      |                      |
      |                      long long int
In file included from gap.cpp:3:
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:75:25: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   75 |   MinMax(f + 1, INF, s, err);
      |                         ^~~
      |                         |
      |                         long long int
In file included from gap.cpp:3:
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:81:36: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   81 |     MinMax(last + 1, last + mxGap, cur, next);
      |                                    ^~~
      |                                    |
      |                                    long long int
In file included from gap.cpp:3:
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:81:41: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   81 |     MinMax(last + 1, last + mxGap, cur, next);
      |                                         ^~~~
      |                                         |
      |                                         long long int
In file included from gap.cpp:3:
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:83:29: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   83 |       MinMax(last + 1, INF, cur, next);
      |                             ^~~
      |                             |
      |                             long long int
In file included from gap.cpp:3:
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:83:34: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   83 |       MinMax(last + 1, INF, cur, next);
      |                                  ^~~~
      |                                  |
      |                                  long long int
In file included from gap.cpp:3:
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: In function 'void freop(std::string)':
gap.cpp:55:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |   freopen((s + ".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gap.cpp:56:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   56 |   freopen((s + ".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~