제출 #996345

#제출 시각아이디문제언어결과실행 시간메모리
996345Alfraganus선물상자 (IOI15_boxes)C++17
0 / 100
5 ms348 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; #define ll long long ll delivery(int n, int k, int l, int p[]) { ll ans = 1e18; auto get = [&](ll x){return min(x, l - x);}; vector<int> q; for(int i = 0; i < n; i ++) if(p[i] != 0) q.push_back(p[i]); n = (int)q.size(); for(int i = 0; i <= n; i ++){ deque<int> dq; for(int j = 0; j < i; j ++) dq.push_back(q[j]); ll mx = 0; while(dq.size() > 0){ int sz = (int)dq.size(); ll clock = dq[min(sz - 1, k - 1)] + get(dq[min(sz - 1, k - 1)]); mx += clock; for(int i = 0; i < min(sz, k); i ++) dq.pop_front(); } for(int j = i; j < n; j ++) dq.push_back(q[j]); while(dq.size() > 0){ int sz = (int)dq.size(); ll counterclock = dq[max(0, sz - k)] + get(dq[max(0, sz - k)]); mx += counterclock; for(int i = 0; i < min(sz, k); i ++) dq.pop_back(); } ans = min(ans, mx); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:24:21: warning: declaration of 'i' shadows a previous local [-Wshadow]
   24 |             for(int i = 0; i < min(sz, k); i ++)
      |                     ^
boxes.cpp:15:13: note: shadowed declaration is here
   15 |     for(int i = 0; i <= n; i ++){
      |             ^
boxes.cpp:33:21: warning: declaration of 'i' shadows a previous local [-Wshadow]
   33 |             for(int i = 0; i < min(sz, k); i ++)
      |                     ^
boxes.cpp:15:13: note: shadowed declaration is here
   15 |     for(int i = 0; i <= n; i ++){
      |             ^
#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...