제출 #1009261

#제출 시각아이디문제언어결과실행 시간메모리
1009261Ausp3x선물상자 (IOI15_boxes)C++17
20 / 100
0 ms348 KiB
// 人外有人,天外有天 // author: Ausp3x #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> typedef long long lng; typedef unsigned int uint; typedef unsigned long long ulng; using namespace std; using namespace __gnu_pbds; int const INF32 = 0x3f3f3f3f; lng const INF64 = 0x3f3f3f3f3f3f3f3f; lng delivery(int N, int K, int L, int positions[]) { vector<int> cw, ccw; for (int i = 0; i < N; i++) if (positions[i] <= L - positions[i]) cw.push_back(positions[i]); else ccw.push_back(L - positions[i]); sort(cw.begin(), cw.end(), greater<int>()); sort(ccw.begin(), ccw.end(), greater<int>()); lng ans = 0; for (int i = 0; i < cw.size(); i += K) ans += 2 * cw[i]; for (int i = 0; i < ccw.size(); i += K) ans += 2 * ccw[i]; for (int i = 0; i < K - 1; i++) { lng cur = L; for (int j = i + 1; j < cw.size(); j += K) cur += 2 * cw[i]; for (int j = K - i - 1; j < ccw.size(); j += K) cur += 2 * ccw[i]; ans = min(ans, cur); } return ans; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; cin >> t; while (t--) { int N, K, L; cin >> N >> K >> L; vector<int> positions(N); for (int &p : positions) cin >> p; cout << delivery(N, K, L, positions) << endl; } return 0; } //*/

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

boxes.cpp:4:55: warning: bad option '-f O2' to pragma 'optimize' [-Wpragmas]
    4 | #pragma GCC optimize("O1, O2, O3, Ofast, unroll-loops")
      |                                                       ^
boxes.cpp:4:55: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
boxes.cpp:4:55: warning: bad option '-f Ofast' to pragma 'optimize' [-Wpragmas]
boxes.cpp:4:55: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
boxes.cpp:16:50: warning: bad option '-f O2' to attribute 'optimize' [-Wattributes]
   16 | lng delivery(int N, int K, int L, int positions[]) {
      |                                                  ^
boxes.cpp:16:50: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
boxes.cpp:16:50: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes]
boxes.cpp:16:50: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
boxes.cpp: In function 'lng delivery(int, int, int, int*)':
boxes.cpp:28:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for (int i = 0; i < cw.size(); i += K)
      |                     ~~^~~~~~~~~~~
boxes.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i = 0; i < ccw.size(); i += K)
      |                     ~~^~~~~~~~~~~~
boxes.cpp:35:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for (int j = i + 1; j < cw.size(); j += K)
      |                             ~~^~~~~~~~~~~
boxes.cpp:37:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for (int j = K - i - 1; j < ccw.size(); j += K)
      |                                 ~~^~~~~~~~~~~~
#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...