# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1015173 |
2024-07-06T06:59:52 Z |
vjudge1 |
Gap (APIO16_gap) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
// #include "grader.cpp"
#include "gap.h"
using namespace std;
typedef long long ll;
set<ll> st;
void recur(ll l, ll r){
if (r - l <= 1){
MinMax(l, r, &l, &r);
if (l != -1){
st.insert(l);
st.insert(r);
}
return ;
}
ll mid = (l + r) / 2;
ll mn, mx;
MinMax(l, mid, &mn, &mx);
if (mn != -1){
st.insert(mn);
st.insert(mx);
recur(mn + 1, mx - 1);
}
MinMax(mid + 1, r, &mn, &mx);
if (mn != -1){
st.insert(mn);
st.insert(mx);
recur(mn + 1, mx - 1);
}
}
ll findGap(ll T, ll N){
if (T == 1){
ll mn = 0, mx = 1e18;
while (N > 0){
N -= 2;
MinMax(mn, mx, &mn, &mx);
st.insert(mn);
st.insert(mx);
mn++;
mx--;
}
}
else{
recur(0, 1e18);
}
vector<ll> vec;
for (ll x : st)
vec.push_back(x);
ll res = 0;
for (ll i = 1; i < vec.size(); i ++)
res = max(res, vec[i] - vec[i - 1]);
return res;
}
Compilation message
gap.cpp: In function 'll findGap(ll, ll)':
gap.cpp:62:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
62 | for (ll i = 1; i < vec.size(); i ++)
| ~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccBYDSPB.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status