제출 #968519

#제출 시각아이디문제언어결과실행 시간메모리
968519duckindog선물상자 (IOI15_boxes)C++17
10 / 100
1 ms460 KiB
#include <bits/stdc++.h> using namespace std; #ifndef LOCAL #include "boxes.h" #endif long long delivery(int n, int k, int l, int p[]) { if (k == 1 || k == n) { long long answer = 0; for (int i = 0; i < n; ++i) answer += min(p[i], l - p[i]); if (k == 1) return answer << 1; return min(1ll * l, answer << 1); } } #ifdef LOCAL const int N = 10'000'000 + 10; int n, k, l; int p[N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> k >> l; for (int i = 0; i < n; ++i) cin >> p[i]; cout << delivery(n, k, l, p) << "\n"; } #endif

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^
#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...