Submission #1299673

#TimeUsernameProblemLanguageResultExecution timeMemory
1299673wojtekmalRice Hub (IOI11_ricehub)C++20
100 / 100
8 ms584 KiB
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; #define ll long long int besthub(int R, int L, int X[], long long B) { int maxx = 0; int begg = 0, endd = -1; int midd = -1; int parity = 1; ll cost = 0; int rice_amount = 0; while (true) { if (parity) midd++; parity ^= 1; if (cost <= B) { maxx = max(maxx, rice_amount); endd++; if (endd == R) break; rice_amount++; cost += X[endd] - X[midd]; } else { cost -= X[midd] - X[begg]; begg++; rice_amount--; } } return maxx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...