제출 #344752

#제출 시각아이디문제언어결과실행 시간메모리
344752iliccmarko선물상자 (IOI15_boxes)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; #define ll long long #define endl "\n" #define INF 1000000000 #define LINF 1000000000000000LL #define pb push_back #define all(x) x.begin(), x.end() #define len(s) (int)s.size() #define test_case { int t; cin>>t; while(t--)solve(); } #define single_case solve(); #define line cerr<<"----------"<<endl; #define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); } #define mod 1000000007LL const int N = 1e7 + 5; ll l[N], r[N]; ll delivery(int n, int k, int L, int p[]) { for(int i = 0;i<n;i++) { if(i>=k) { l[i+1] = l[i-k+1] + 2*p[i]; } else { l[i+1] = 2*p[i]; } } for(int i = n-1;i>=0;i--) { if(n-1-i>=k+1) { r[i+1] = r[i+k+1] + 2*(L-p[i]); } else { r[i+1] = 2*(L-p[i]); } } ll ans = LINF; for(int i = 0;i<n;i++) { ans = min(ans, l[i+1]+r[n-i+1]); } for(int i = 0;i<=n;i++) { if(i+k>n) break; ans = min(ans, l[i]+L+r[n-i-k]); } return ans; }
#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...