제출 #238082

#제출 시각아이디문제언어결과실행 시간메모리
238082DS007Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long solve1(int n) { set<long long> s; long long l = 0, h = 1e18; while (s.size() != n) { long long mn = -1, mx = -1; MinMax(l, h, mn, mx); l = mn + 1, h = mx - 1; s.insert(mn); s.insert(mx); } long long last = 1e18, ans = 0; for (auto i : s) { ans = max(ans, i - last); last = i; } return ans; } long long solve2(int n) { long long mn = -1, mx = -1, l = 0, h = 1e18, tm1 = -1, tm2 = -1; MinMax(l, h, mn, mx); if (n == 2) return mx - mn; long long m = (mx - mn) / (n - 2), last = 1e18, ans = 0; for (long long i = mn; i < mx; i += m) { MinMax(i, i + m, tm1, tm2); ans = max(ans, tm1 - last); last = tm2; } return ans; } long long solve(int t, int n) { if (t == 1) return solve1(n); else return solve2(n); } /*int solveTestCase() { } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int test = 1; // cin >> test; while (test--) solveTestCase(); }*/

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

gap.cpp: In function 'long long int solve1(int)':
gap.cpp:8:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (s.size() != n) {
            ~~~~~~~~~^~~~
gap.cpp:10:28: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
         MinMax(l, h, mn, mx);
                            ^
In file included from gap.cpp:2: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:10:28: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
         MinMax(l, h, mn, mx);
                            ^
In file included from gap.cpp:2: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: In function 'long long int solve2(int)':
gap.cpp:27:24: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
     MinMax(l, h, mn, mx);
                        ^
In file included from gap.cpp:2: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:27:24: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
     MinMax(l, h, mn, mx);
                        ^
In file included from gap.cpp:2: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:34:34: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
         MinMax(i, i + m, tm1, tm2);
                                  ^
In file included from gap.cpp:2: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:34: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
         MinMax(i, i + m, tm1, tm2);
                                  ^
In file included from gap.cpp:2: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*);
      ^~~~~~