Submission #142730

#TimeUsernameProblemLanguageResultExecution timeMemory
142730HellAngelGap (APIO16_gap)C++14
0 / 100
75 ms3464 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long findGap(int T, int N) { long long ans = 0; vector<long long> vt = {}; long long Max, Min; MinMax(0, 1e18, &Min, &Max); if(T == 1) { vt.push_back(Max); vt.push_back(Min); long long l = Min + 1; long long r = Max - 1; while(l <= r) { long long a, b; MinMax(l, r, &a, &b); if(a == -1) { break; } vt.push_back(a); vt.push_back(b); l = a + 1; r = b - 1; } } else { long long qr = (Max - Min + N - 2) / (N - 1); ans = qr; for(long long x = Min; x <= Max ; x += qr + 1) { long long xa,xb; MinMax(x,x+qr,&xa,&xb); vt.push_back(xa),vt.push_back(xb); } } for(int i = 1; i < vt.size(); i++) ans = max(ans, vt[i] - vt[i - 1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:43:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < vt.size(); i++) ans = max(ans, vt[i] - vt[i - 1]);
                    ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...