제출 #64883

#제출 시각아이디문제언어결과실행 시간메모리
64883Talant선물상자 (IOI15_boxes)C++17
10 / 100
3 ms376 KiB
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb push_back using namespace std; const int N = (1e6 + 5); const int inf = (1e9 + 7); long long ans; long long delivery(int N, int K, int L, int p[]) { if (K == 1) { for (int i = 0; i < N; i ++) ans += min(p[i] * 2,(L - p[i]) * 2); } else if (K == N) { ans = L; for (int i = 0; i < N; i ++) ans = min(ans,(long long)(p[i] * 2 + (L - p[i + 1]) * 2)); ans = min(ans,(long long)(L - p[0]) * 2); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:18:48: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 long long delivery(int N, int K, int L, int p[]) {
                                                ^
boxes.cpp:13:11: note: shadowed declaration is here
 const int N = (1e6 + 5);
           ^
#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...