제출 #793489

#제출 시각아이디문제언어결과실행 시간메모리
793489Markynoodle선물상자 (IOI15_boxes)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll delivery(int n, int k, int l, int posin[]){ vector<int> pos(n); for(int i =0; i<n ;i++){ pos[i] = posin[i]; } ll sol = 1e16; sort(pos.begin(), pos.end()); for(int i = 0; i<=n; i++){ ll tempsol = 0; int cnt = i-1; //int cycle = 1; while(cnt >= 0){ tempsol += pos[cnt]; tempsol += min(pos[cnt], l - pos[cnt]); cnt -= k; /* if(cnt + 1 == i){ tempsol += pos[cnt]; tempsol += min(pos[cnt], l - pos[cnt]); break; } if(cycle == k){ tempsol += pos[cnt]; tempsol += min(pos[cnt], l - pos[cnt]); cycle = 0; } cnt++; cycle++; */ } //cout<<tempsol<<" "; cnt = i; //cycle = 1; while(cnt <= n-1){ tempsol += pos[cnt]; tempsol += min(pos[cnt], l - pos[cnt]); cnt += k; /* if(cnt == i){ tempsol += l - pos[cnt]; tempsol += min(pos[cnt], l - pos[cnt]); break; } if(cycle == k){ tempsol += l - pos[cnt]; tempsol += min(pos[cnt], l - pos[cnt]); cycle = 0; } cnt--; cycle++; */ } sol = min(sol, tempsol); //cout<<tempsol<<"_"; } return sol; }
#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...