Submission #323192

#TimeUsernameProblemLanguageResultExecution timeMemory
323192couplefireGap (APIO16_gap)C++17
0 / 100
58 ms3168 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long solve1(int n){ queue<long long> left; stack<long long> right; long long cl = 0, cr = 1000000000000000000; while(left.size()+right.size() < n){ long long a, b; MinMax(cl, cr, &a, &b); left.push(a); right.push(b); cr = b-1, cl = a+1; } vector<long long> v; while(!left.empty()){ v.push_back(left.front()); left.pop(); } while(!right.empty()){ v.push_back(right.top()); right.pop(); } long long ans = 0; for(int i = 1; i<v.size(); i++) ans = max(ans, v[i]-v[i-1]); return ans; } void solve2(int n){ } long long findGap(int T, int N){ if(T == 2) return solve1(N); return 0; }

Compilation message (stderr)

gap.cpp: In function 'long long int solve1(int)':
gap.cpp:8:33: warning: comparison of integer expressions of different signedness: 'std::queue<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |  while(left.size()+right.size() < n){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
gap.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i = 1; i<v.size(); i++) ans = max(ans, v[i]-v[i-1]);
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...