Submission #920128

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9201282024-02-02 05:24:02coding_snorlaxBoxes with souvenirs (IOI15_boxes)C++14
35 / 100
1 ms600 KiB
#include "boxes.h"
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<ll> P;
vector<ll> Le,R,Ri;
ll n,k,l;
void pre_L(){
Le.push_back(0);
for(ll i=0;i<k;i++) Le.push_back(2*P[i]);
for(ll i=k;i<n;i++){
Le.push_back(2*P[i]+Le[i+1-k]);
}
Le.push_back(0);
}
void pre_R(){
for(ll i=n-1;i>=n-k;i--) R.push_back(2*(l-P[i]));
for(ll i=n-k-1;i>=0;i--){
R.push_back(2*(l-P[i])+R[n-k-1-i]);
}
Ri.push_back(0);
for(ll i=n-1;i>=0;i--) Ri.push_back(R[i]);
Ri.push_back(0);
}
long long cal(int lb,int rb){
ll answer = ((rb-lb+1)/k)*l;
if((rb-lb+1)%k) answer += l;
answer += Le[lb-1];
answer += Ri[rb+1];
return answer;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...