제출 #204191

#제출 시각아이디문제언어결과실행 시간메모리
204191awlintqaa선물상자 (IOI15_boxes)C++14
10 / 100
5 ms428 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 200 #define mid (l+r)/2 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C continue #define mem(dp,i) memset(dp,i,sizeof(dp)) #define mset multiset typedef long long ll; typedef short int si; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; const ll mod=1e9+7; const ll inf= 4e18; const ld pai=acos(-1); #include "boxes.h" ll P[1009]; ll solve ( ll N , ll K ,ll L ) { ll ans = 0 , last = 0; ll k = K ; for(int i =0 ;i < N ;i ++ ) { ll x1 = abs ( last - P[i] ); ll x2 = L - abs ( last - P[i] ); ans += min ( x1 , x2 ); last = P[i]; k -- ; if ( x2 <= x1 ) k = K ; if ( k == 0){ ans += min ( abs(last-0) , L - abs(last-0) ) ; last = 0 ; k = K ; } } if ( k ) ans += min ( abs(last-0) , L - abs(last-0) ) ; return ans ; } long long delivery(int N, int K, int L, int p[]) { for ( int i = 0 ; i < N ; i ++ )P[i] = p[i]; return solve ( N , K , L ) ; }
#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...