Submission #713430

#TimeUsernameProblemLanguageResultExecution timeMemory
713430Vu_CG_CoderGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <stdio.h> #include <stdlib.h> #include <vector> #include <bits/stdc++.h> #include "gap.h" #define ll long long using namespace std; long long sub1(int n) { long long l = 0 , r = 1e18; vector <long long> kq; for (int i = 1 ; i <= (n + 1)/2 ; i++) { ll s , t; MinMax(l,r,&s,&t); kq.push_back(s); kq.push_back(t); l = (s) + 1; r = (t) - 1; } sort(kq.begin(),kq.end()); long long res = 0; for (int i = 1 ; i < kq.size() ; i++) res = max(res,kq[i] - kq[i - 1]); return res; } long long sub2(int n) { long long mn , mx , a = 0 , b = 1e18; MinMax(a,b,&mn,&mx); long long res = 0; long long step = (mx - mn + 1 + n)/(n - 1); int l = mn , long long i = step; for (i = step ; i <= mx ; i += step) { long long x , y; MinMax(i + 1,min(i+step,mx),&x,&y); if (x != -1) { res = max(res,x - l); l = y; } } return res; } long long findGap(int t , int n) { if (t == 1) return sub1(); else return sub2(); }

Compilation message (stderr)

gap.cpp: In function 'long long int sub1(int)':
gap.cpp:28:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for (int i = 1 ; i < kq.size() ; i++)
      |                      ~~^~~~~~~~~~~
gap.cpp: In function 'long long int sub2(int)':
gap.cpp:41:18: error: expected unqualified-id before 'long'
   41 |     int l = mn , long long i = step;
      |                  ^~~~
gap.cpp:42:10: error: 'i' was not declared in this scope
   42 |     for (i = step ; i <= mx ; i += step)
      |          ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:57:29: error: too few arguments to function 'long long int sub1(int)'
   57 |     if (t == 1) return sub1();
      |                             ^
gap.cpp:10:11: note: declared here
   10 | long long sub1(int n)
      |           ^~~~
gap.cpp:58:22: error: too few arguments to function 'long long int sub2(int)'
   58 |     else return sub2();
      |                      ^
gap.cpp:33:11: note: declared here
   33 | long long sub2(int n)
      |           ^~~~