Submission #976816

#TimeUsernameProblemLanguageResultExecution timeMemory
976816AmaarsaaBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
566 ms293768 KiB
#include<bits/stdc++.h> #include "boxes.h" using namespace std; using ll = long long ; ll delivery(int N,int K, int L, int p[]) { ll ans, cnt_ard, cnt_urd, res, i; ll Pre[N + 2], Suf[N + 2]; Pre[0] = Suf[0] = 0; for (i = 1; i <= N; i ++) { Suf[i] = Suf[max(i - K, 0ll)] + p[i- 1] * 2; Pre[i] = Pre[max(i - K, 0ll)] + (L - p[N - i]) * 2; } ans = 1e18; for (i = 0; i <= N; i ++) { ans = min(ans, Pre[i] + min(Suf[N - i], Suf[max(N - i - K, 0ll)] + L)); } return ans ; }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:7:10: warning: unused variable 'cnt_ard' [-Wunused-variable]
    7 |  ll ans, cnt_ard, cnt_urd, res, i;
      |          ^~~~~~~
boxes.cpp:7:19: warning: unused variable 'cnt_urd' [-Wunused-variable]
    7 |  ll ans, cnt_ard, cnt_urd, res, i;
      |                   ^~~~~~~
boxes.cpp:7:28: warning: unused variable 'res' [-Wunused-variable]
    7 |  ll ans, cnt_ard, cnt_urd, res, i;
      |                            ^~~
#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...