Submission #1091027

#TimeUsernameProblemLanguageResultExecution timeMemory
1091027NurislamGap (APIO16_gap)C++17
30 / 100
38 ms2384 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" typedef long long ll; ll solve1(int t, int n){ ll l = 0, r = 1e18; vector<ll> a; ll lf = 1, rf = 1; while(1){ MinMax(l, r, &lf, &rf); if(lf == -1)break; a.pb(lf); a.pb(rf); l = lf+1, r = rf-1; if(lf == rf || a.size() >= n)break; } ll ans = 1; sort(all(a)); //for(auto i:a)cout << i << ' '; //cout << '\n'; for(int i = 1; i < a.size(); i++) ans = max(ans, a[i] - a[i-1]); 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 'll solve1(int, int)':
gap.cpp:24:27: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |   if(lf == rf || a.size() >= n)break;
      |                  ~~~~~~~~~^~~~
gap.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for(int i = 1; i < a.size(); i++)
      |                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...