Submission #914844

#TimeUsernameProblemLanguageResultExecution timeMemory
914844tvladm2009Rice Hub (IOI11_ricehub)C++17
0 / 100
3 ms4700 KiB
#include <iostream> #include <complex> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <numeric> #include <cstring> #include <ctime> #include <cstdlib> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <cmath> #include <bitset> #include <cassert> #include <queue> #include <stack> #include <deque> #include <random> using namespace std; template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;} template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;} #define files(FILENAME) read(FILENAME); write(FILENAME) #define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin) #define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout) #define all(c) (c).begin(), (c).end() #define sz(c) (int)(c).size() #define left left228 #define right right228 #define y1 y1228 #define mp make_pair #define pb push_back #define y2 y2228 #define rank rank228 using ll = long long; using ld = long double; const string FILENAME = "input"; const int LMAX = 1000228; int sum[LMAX]; int besthub(int n, int L, int x[], ll b) { for (int i = 0; i < n; i++) { sum[x[i]]++; } for (int i = 1; i <= L; i++) { sum[i] += sum[i - 1]; } int ans = 0; for (int i = 1; i <= L; i++) { int lft = (i - b / 2 > 0 ? sum[i] - sum[i - b / 2 - 1] : sum[i]); int rgh = (i + b / 2 <= n ? sum[i + b / 2] - sum[i - 1] : sum[n] - sum[i - 1]); chkmax(ans, lft + rgh); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...