제출 #1082223

#제출 시각아이디문제언어결과실행 시간메모리
1082223raphael_heuchl선물상자 (IOI15_boxes)C++14
10 / 100
1 ms448 KiB
#include "boxes.h" #include <vector> #include <algorithm> #include <map> #include <iostream> #define INF 1'000'000'000'000'000'000 #define MIN(a, b) ((a) < (b) ? (a) : (b)) long long delivery(int N, int K, int L, int p[]) { long long best = INF; for (int i = 0; i < K; ++i) { long long sum = 0; long long pos = i; sum += p[i] + MIN(p[i], L - p[i]); while (pos < N-1) sum += MIN(L - 2*p[pos+1], 0) + p[pos=MIN(pos+K, N-1)] + MIN(p[pos], L - p[pos]); best = MIN(best, sum); } return best; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:19:50: warning: operation on 'pos' may be undefined [-Wsequence-point]
   19 |             sum += MIN(L - 2*p[pos+1], 0) + p[pos=MIN(pos+K, N-1)] + MIN(p[pos], L - p[pos]);
      |                                                  ^
boxes.cpp:19:50: warning: operation on 'pos' may be undefined [-Wsequence-point]
boxes.cpp:19:50: warning: operation on 'pos' may be undefined [-Wsequence-point]
boxes.cpp:19:50: warning: operation on 'pos' may be undefined [-Wsequence-point]
#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...