Submission #403029

#TimeUsernameProblemLanguageResultExecution timeMemory
403029CursedCodeGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> #define pb push_back using namespace std; long long findGap(int T, long long N){ long long p = 0, q = (lld)1e18 + 1; vector <long long> a; while(true){ long long m1, m2; MinMax(p + 1, q - 1, &m1, &m2); a.pb(m1); a.pb(m2); if (m1 == m2 || a.size() == N) break; p = m1, q = m2; } sort(a.begin(),a.end()); long long ans = 0; for (int i = 1;i < sz(a);i++) ans = max(ans, a[i] - a[i - 1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, long long int)':
gap.cpp:7:24: error: 'lld' was not declared in this scope; did you mean 'lldiv'?
    7 |  long long p = 0, q = (lld)1e18 + 1;
      |                        ^~~
      |                        lldiv
gap.cpp:13:28: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   13 |   if (m1 == m2 || a.size() == N) break;
      |                   ~~~~~~~~~^~~~
gap.cpp:18:21: error: 'sz' was not declared in this scope
   18 |  for (int i = 1;i < sz(a);i++)
      |                     ^~