Submission #142735

#TimeUsernameProblemLanguageResultExecution timeMemory
142735HellAngelGap (APIO16_gap)C++14
70 / 100
88 ms3352 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 = 2; long long r = N - 1; while(l <= r) { long long a, b; MinMax(Min, Max, &a, &b); vt.push_back(a); vt.push_back(b); Min = a + 1; Max = 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); } } sort(vt.begin(), vt.end()); 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:40: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...