제출 #604281

#제출 시각아이디문제언어결과실행 시간메모리
6042818e7선물상자 (IOI15_boxes)C++17
100 / 100
479 ms199436 KiB
//Challenge: Accepted #include <bits/stdc++.h> using namespace std; #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r){ while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 10000005 #define pii pair<int, int> #define ff first #define ss second #include "boxes.h" const ll inf = 1LL<<60; ll pref[maxn], suf[maxn]; long long delivery(int n, int K, int L, int p[]) { for (int i = 0;i < n;i++) { pref[i] = 2 * p[i]; if (i >= K) pref[i] += pref[i-K]; } pary(pref, pref + n); for (int i = n - 1;i >= 0;i--) { suf[i] = 2 * (L - p[i]); if (i < n - K) suf[i] += suf[i+K]; } pary(suf, suf + n); ll ans = suf[0]; for (int i = 0;i < n;i++) { ans = min(ans, pref[i] + suf[i+1]); } ans = min(ans, L + suf[K]); for (int i = 0;i + K + 1 <= n;i++) { ans = min(ans, pref[i] + L + suf[i+K+1]); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:13:19: warning: statement has no effect [-Wunused-value]
   13 | #define pary(...) 0
      |                   ^
boxes.cpp:29:2: note: in expansion of macro 'pary'
   29 |  pary(pref, pref + n);
      |  ^~~~
boxes.cpp:13:19: warning: statement has no effect [-Wunused-value]
   13 | #define pary(...) 0
      |                   ^
boxes.cpp:34:2: note: in expansion of macro 'pary'
   34 |  pary(suf, suf + n);
      |  ^~~~
#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...