Submission #1082223

#TimeUsernameProblemLanguageResultExecution timeMemory
1082223raphael_heuchlBoxes with souvenirs (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; }

Compilation message (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...