제출 #996447

#제출 시각아이디문제언어결과실행 시간메모리
996447fryingduc선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
const int maxn = 1e7 + 7; long long fcw[maxn], fccw[maxn]; long long delivery(int n, int k, int l, int pos[]) { for(int i = 1; i <= n; ++i) { fcw[i] = fcw[max(0, i - k)] + pos[i] + min(pos[i], l - pos[i]); } for(int i = n; i; --i) { fccw[i] = fccw[min(n + 1, i + k)] + (l - pos[i]) + min(pos[i], l - pos[i]); } long long ans = 1e18; for(int i = 1; i <= n; ++i) { ans = min(ans, fccw[i] + fcw[i] - min(pos[i], l - pos[i])); } cout << ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:5:22: error: 'max' was not declared in this scope; did you mean 'maxn'?
    5 |         fcw[i] = fcw[max(0, i - k)] + pos[i] + min(pos[i], l - pos[i]);
      |                      ^~~
      |                      maxn
boxes.cpp:5:48: error: 'min' was not declared in this scope
    5 |         fcw[i] = fcw[max(0, i - k)] + pos[i] + min(pos[i], l - pos[i]);
      |                                                ^~~
boxes.cpp:8:24: error: 'min' was not declared in this scope
    8 |         fccw[i] = fccw[min(n + 1, i + k)] + (l - pos[i]) + min(pos[i], l - pos[i]);
      |                        ^~~
boxes.cpp:13:43: error: 'min' was not declared in this scope
   13 |         ans = min(ans, fccw[i] + fcw[i] - min(pos[i], l - pos[i]));
      |                                           ^~~
boxes.cpp:13:15: error: 'min' was not declared in this scope
   13 |         ans = min(ans, fccw[i] + fcw[i] - min(pos[i], l - pos[i]));
      |               ^~~
boxes.cpp:15:5: error: 'cout' was not declared in this scope
   15 |     cout << ans;
      |     ^~~~
boxes.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
   16 | }
      | ^