Submission #109876

#TimeUsernameProblemLanguageResultExecution timeMemory
109876Nucleist쌀 창고 (IOI11_ricehub)C++14
0 / 100
1073 ms476 KiB
#include <bits/stdc++.h> using namespace std; #define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define debug(x) cerr << " - " << #x << ": " << x << endl; #define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl; #define all(x) (x).begin(),(x).end() #define sz(x) (ll)x.size() #define ll long long #define INF 1000000000 #define pb push_back struct greateri { template<class T> bool operator()(T const &a, T const &b) const { return a > b; } }; ll besthub(int r,int l,int x[],ll b) { //flash; ll glob = 0; ll ans=0; for (ll i = 0; i < r; ++i) { for (ll j = i+1; j < r; ++j) { ll med = (x[j]+x[i])/2; ll ans = 0; for (ll s = i; s <= j; ++s) { ans+=abs(x[s]-med); } //debug(ans); //debugs(i,j); if(ans<=b) glob=max(glob,j-i+1); } } return glob; }

Compilation message (stderr)

ricehub.cpp: In function 'long long int besthub(int, int, int*, long long int)':
ricehub.cpp:21:6: warning: unused variable 'ans' [-Wunused-variable]
   ll ans=0;
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...