제출 #1100032

#제출 시각아이디문제언어결과실행 시간메모리
1100032MrPavlito선물상자 (IOI15_boxes)C++17
0 / 100
1 ms2396 KiB
#include "boxes.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define sc second //#define endl "\n" #define pii pair<int,int> using namespace std; const int MAXN = 1e7+5; const int mod7 = 1e9+7; const long long inf = 1e18; long long clockwise[MAXN]; long long cclockwise[MAXN]; long long delivery(int N, int K, int L, int p[]) { for(int i=0; i<N; i++)clockwise[i] = min(p[i]*2, L), cclockwise[i] = min((L-p[i]) * 2, L); //for(int i=0; i<N; i++)cout << clockwise[i] << " ";cout << endl; //for(int i=0; i<N; i++)cout << cclockwise[i] << " ";cout << endl; for(int i=K; i<N; i++)clockwise[i] += clockwise[i-K]; for(int i=N-K-1; i>=0; i--)cclockwise[i] += cclockwise[i+K]; //for(int i=0; i<N; i++)cout << clockwise[i] << " ";cout << endl; //for(int i=0; i<N; i++)cout << cclockwise[i] << " ";cout << endl; long long rez = inf; for(int i=0; i<N; i++)rez = min(rez, clockwise[i] + cclockwise[(i+1)%N]); return rez; }
#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...