제출 #624894

#제출 시각아이디문제언어결과실행 시간메모리
624894brucecccccc선물상자 (IOI15_boxes)C++14
50 / 100
2074 ms19948 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e7+5; ll f[MAXN], b[MAXN]; ll delivery(int N, int K, int L, int p[]) { int i = 0; while (i < N && f[i] == 0) { f[i] = p[i] + min(p[i], L - p[i]); for (int j = i + K; j < N; j += K) { f[j] = f[j-K] + p[j] + min(p[j], L - p[j]); } i++; } i = N-1; while (i >= 0 && b[i] == 0) { b[i] = L - p[i] + min(p[i], L - p[i]); for (int j = i - K; j >= 0; j -= K) { b[j] = b[j+K] + L - p[j] + min(p[j], L - p[j]); } i--; } ll ans = min(f[N-1], b[0]); for (int i = 0; i < N - 1; i++) { ans = min(ans, f[i] + b[i+1]); } return ans; }

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:30:12: warning: declaration of 'i' shadows a previous local [-Wshadow]
   30 |   for (int i = 0; i < N - 1; i++) {
      |            ^
boxes.cpp:11:7: note: shadowed declaration is here
   11 |   int i = 0;
      |       ^
#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...