Submission #1123666

#TimeUsernameProblemLanguageResultExecution timeMemory
1123666math_rabbit_1028Nile (IOI24_nile)C++20
0 / 100
33 ms4796 KiB
#include "nile.h" using namespace std; typedef long long ll; typedef pair<ll, ll> pll; vector<ll> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) { int Q = (int)E.size(); int N = (int)W.size(); ll sum = 0; for (int i = 0; i < N; i++) sum += A[i]; vector<ll> R(Q, sum); vector<pll> C; for (int i = 0; i < N; i++) C.push_back({W[i], A[i]-B[i]}); sort(C.begin(), C.end()); for (int t = 0; t < Q; t++) { ll D = E[t]; ll st = 0; while (st < N) { for (int i = st+1; i <= N; i++) { if (i == N || C[i].first - C[i-1].first > D) { R[t] -= (i-st)/2; st = i; break; } } } } return R; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...