Submission #668247

#TimeUsernameProblemLanguageResultExecution timeMemory
668247birthdaycakeGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;


long long findGap(long long T, long long N){
    long long l = 0, r = 0, mn = 0, mx = 0;
    MinMax(1, 1000000000000000000, &mn, &mx);
    l = mn; r = mx;
    long long sz = (r - l + 1) / (N - 1);
    vector<pair<int,int>>d;
    for(int j = l; j <= r; j += sz+1){
        MinMax(j, j + sz, &mn, &mx);
        d.push_back({mn, mx});
    }
    long long ans = (r - l + 1) / (N - 1);
    mn = d[0].first; mx = d[0].second;
    for(int i = 1; i < d.size(); i++){
        if(mx != -1 && d[i].first != -1){
            ans = max(ans, d[i].first - mx);
            mn = d[i].first;
            mx = d[i].second;
        }
        
    }
    return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(long long int, long long int)':
gap.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 1; i < d.size(); i++){
      |                    ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccaydFEt.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status