제출 #1130241

#제출 시각아이디문제언어결과실행 시간메모리
1130241sohamsen15코끼리 (Dancing Elephants) (IOI11_elephants)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 999999;

vector<int> a;
int n, l;

void init(int N, int L, int[] X) {
    n = N; l = L;
    for (int i = 0; i < n; i++)
        a.push_back(X[i]);
}

int update(int idx, int y) {
    a[idx] = y;
    vector<int> b; for (auto &x: a) b.push_back(x);
    sort(b.begin(), b.end());
    int ans = 0;
    for (int i = 0; i < n;) {
        ans++;
        bool done = false;
        for (int j = i + 1; j < n; j++) {
            if (b[j] - b[i] > l) {
                done = true;
                i = j; break;
            } else if (j == n - 1) {
                i = n;
                done = true;
            }
        }
        if (!done) i++;
    }
    return ans;
}

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

elephants.cpp:9:31: error: expected ',' or '...' before 'X'
    9 | void init(int N, int L, int[] X) {
      |                               ^
elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:12:21: error: 'X' was not declared in this scope
   12 |         a.push_back(X[i]);
      |                     ^