Submission #310143

#TimeUsernameProblemLanguageResultExecution timeMemory
310143aZvezdaBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms384 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") #define endl "\n" typedef long long ll; template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;} template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;} template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } const ll mod = 1e9 + 7; #define out(x) "{" << (#x) << ": " << x << "} " long long delivery(int N, int K, int L, int p[]) { int l = 0, r = N - 1; long long ret = 0; int k = K; while(true) { if(r - l + 1 <= k) { ret += min(L, min(2 * L - 2 * p[l], 2 * p[r])); break; } if(min(2 * (L - p[r - k + 1]), L) < min(2 * p[l + k - 1], L)) { ret += min(2 * (L - p[r - k + 1]), L); r += k; } else { ret += min(2 * p[l + k - 1], L); l += k; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...