제출 #57908

#제출 시각아이디문제언어결과실행 시간메모리
57908E869120Boxes with souvenirs (IOI15_boxes)C++14
50 / 100
71 ms8300 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; long long delivery(int N, int K, int L, int pos[]) { long long minx = (1LL << 60); for (int i = 0; i <= K; i++) { vector<pair<int, int>>vec; int cx = i; while (cx < i + N) { vec.push_back(make_pair(cx, min(i + N - 1, cx + K - 1))); cx += K; } long long sum = 0; for (int j = 0; j < vec.size(); j++) { long long V1 = pos[vec[j].first % N], V2 = pos[vec[j].second % N]; long long ret = min(V2, L - V1); if (vec[j].first < N && vec[j].second >= N) ret = (L - V1) + V2; ret *= 2; sum += min(1LL * L, ret); } minx = min(minx, sum); } return minx; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:17:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < vec.size(); j++) {
                   ~~^~~~~~~~~~~~
boxes.cpp:21:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if (vec[j].first < N && vec[j].second >= N) ret = (L - V1) + V2; ret *= 2;
    ^~
boxes.cpp:21:69: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    if (vec[j].first < N && vec[j].second >= N) ret = (L - V1) + V2; ret *= 2;
                                                                     ^~~
#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...