제출 #1349800

#제출 시각아이디문제언어결과실행 시간메모리
1349800pmh선물상자 (IOI15_boxes)C++20
컴파일 에러
0 ms0 KiB
#include "boxes.h"
#include<bits/stdc++.h>
using namespace std;

const int N = 1e7 + 5;
int cw[N], ccw[N], a[N];

long long delivery(int n, int k, int l, int pos[]) {
    fr(i, 1, n) a[i] = pos[i - 1];
    fr(i, 1, n) cw[i] = cw[max(0, i - k)] + a[i]*2;
    frd(i, n, 1) ccw[i] = ccw[min(n + 1, i + k)] + 2*(l - a[i]);
    ll ans = 1e18;
    fr(i, 0, n) {
        mini(ans, cw[i] + ccw[i + 1]);
        mini(ans, cw[i] + ccw[min(n + 1, i + k + 1)] + l);
    }
    return ans;
}

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:9:8: error: 'i' was not declared in this scope
    9 |     fr(i, 1, n) a[i] = pos[i - 1];
      |        ^
boxes.cpp:9:5: error: 'fr' was not declared in this scope
    9 |     fr(i, 1, n) a[i] = pos[i - 1];
      |     ^~
boxes.cpp:11:5: error: 'frd' was not declared in this scope
   11 |     frd(i, n, 1) ccw[i] = ccw[min(n + 1, i + k)] + 2*(l - a[i]);
      |     ^~~
boxes.cpp:12:5: error: 'll' was not declared in this scope; did you mean 'l'?
   12 |     ll ans = 1e18;
      |     ^~
      |     l
boxes.cpp:17:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     return ans;
      |            ^~~
      |            abs