Submission #254216

#TimeUsernameProblemLanguageResultExecution timeMemory
254216eohomegrownappsBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms256 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll delivery(int n, int k, int l, int p[]) { ll scoremin = 1e19; ll scoretot = 0; for (int i = 0; i<n; i+=k){ int s = i; int e = min(i+k-1,n-1); scoretot+=min(l,min((l-p[s])*2,p[e]*2)); } //cout<<scoretot<<'\n'; scoremin=min(scoremin,scoretot); scoretot=0; for (int i = n-1; i>=0; i-=k){ int s = max(0,i-k+1); int e = i; scoretot+=min(l,min((l-p[s])*2,p[e]*2)); } //cout<<scoretot<<'\n'; return scoretot; }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:7:19: warning: overflow in implicit constant conversion [-Woverflow]
     ll scoremin = 1e19;
                   ^~~~
#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...