Submission #750901

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

long long findGap(int T, int N){
  set<long long> s;
  long long L, R;
  if(T == 1){
    MinMax(1, 1e18, &L, &R);
    s.insert(L); s.insert(R);
    for(int i = 1; i < (N + 1) >> 1; i++){
      long long qs, qt;
      MinMax(L + 1, R - 1, &qs, &qt);
      s.insert(qs); s.insert(qt);
      L = qs; R = qt;
    }
  }
  else{
    MinMax(1, 1e18, &L, &R);

    long long X = (R - L) / ((N * 1ll) - 1);
    X += (R - L) % ((N * 1ll) - 1) != 0;

    long long qs, qt;
    for(long long i = L + 1; i < R; i += X){
      MinMax(i, i + X - 1, &qs, &qt);
      s.insert(qs); s.insert(qt);
    }
    s.erase(-1ll);
  }

  long long ans = 0, old = L;
  for(auto x : s){
    ans = max(ans, x - old);
    old = x;
  }
  return ans;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc3rtPJD.o: in function `MinMax(long long, long long, long long*, long long*)':
grader.cpp:(.text+0x0): multiple definition of `MinMax(long long, long long, long long*, long long*)'; /tmp/ccSl0yvF.o:gap.cpp:(.text+0x390): first defined here
/usr/bin/ld: /tmp/cc3rtPJD.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccSl0yvF.o:gap.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status