Submission #815064

#TimeUsernameProblemLanguageResultExecution timeMemory
81506412345678Gap (APIO16_gap)C++17
30 / 100
38 ms2336 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define ll long long long long findGap(int T, int N) { ll arr[N], x=0, y=1e18, a, b, idx=0, mx=0; vector<ll> v; while (v.size()<N) { MinMax(x, y, &a, &b); if (a==b) v.push_back(a); else v.push_back(a), v.push_back(b); x=a+1; y=b-1; } sort(v.begin(), v.end()); for (int i=1; i<v.size(); i++) mx=max(mx, v[i]-v[i-1]); return mx; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:20: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |     while (v.size()<N)
      |            ~~~~~~~~^~
gap.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i=1; i<v.size(); i++) mx=max(mx, v[i]-v[i-1]);
      |                   ~^~~~~~~~~
gap.cpp:11:8: warning: unused variable 'arr' [-Wunused-variable]
   11 |     ll arr[N], x=0, y=1e18, a, b, idx=0, mx=0;
      |        ^~~
gap.cpp:11:35: warning: unused variable 'idx' [-Wunused-variable]
   11 |     ll arr[N], x=0, y=1e18, a, b, idx=0, mx=0;
      |                                   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...