제출 #260774

#제출 시각아이디문제언어결과실행 시간메모리
260774ElyesChaabouni선물상자 (IOI15_boxes)C++14
10 / 100
1 ms384 KiB
/*#pragma GCC optimize("O3")*/ #include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_10 299473306 #define INF 1000000001 #define PI 3.14159265358979323846 using namespace std; long long delivery(int N, int K, int L, int p[]) { long long ans=0; int l=0, r=N-1; while(l <= r) { long long x=p[min(r, l+K-1)], y=L-p[max(l, r-K+1)], d=L; if(x <= y) l=min(r, l+K-1)+1; else r=max(l, r-K+1)-1; ans+=min(min(2*x, 2*y), d); } return ans; } //size
#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...