Submission #1091024

#TimeUsernameProblemLanguageResultExecution timeMemory
1091024NurislamGap (APIO16_gap)C++17
0 / 100
37 ms1752 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #include "gap.h" //#define int long long template <class F, class _S> bool chmin(F &u, const _S &v){ bool flag = false; if ( u > v ){ u = v; flag |= true; } return flag; } template <class F, class _S> bool chmax(F &u, const _S &v){ bool flag = false; if ( u < v ){ u = v; flag |= true; } return flag; } int solve1(int t, int n){ long long l = 0, r = 1e18; vector<int> a, b; long long lf = 1, rf = 1; while(1){ MinMax(l, r, &lf, &rf); if(lf == -1)break; a.pb(lf); b.pb(rf); l = lf+1, r = rf-1; if(lf == rf || a.size()*2 >= n)break; } int ans = 1; reverse(all(b)); int last = a[0]; for(int i:a)chmax(ans, i - last), last = i; for(int i:b)chmax(ans, i - last), last = i; return ans; } long long findGap(int t, int n) { //if(t == 1){ return solve1(t, n); //} return 0; }

Compilation message (stderr)

gap.cpp: In function 'int solve1(int, int)':
gap.cpp:42:29: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |   if(lf == rf || a.size()*2 >= n)break;
      |                  ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...