제출 #1130247

#제출 시각아이디문제언어결과실행 시간메모리
1130247sohamsen15코끼리 (Dancing Elephants) (IOI11_elephants)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 999999; int a[50005]; int n, l; void init(int N, int L, int X[]) { n = N; l = L; for (int i = 0; i < n; i++) a[i] = X[i]; } int getMax(int arr[], int n) { int mx = arr[0]; for (int i = 1; i < n; i++) if (arr[i] > mx) mx = arr[i]; return mx; } void countSort(int arr[], int n, int exp) { int output[n]; int i, count[10] = { 0 }; for (i = 0; i < n; i++) count[(arr[i] / exp) % 10]++; for (i = 1; i < 10; i++) count[i] += count[i - 1]; for (i = n - 1; i >= 0; i--) { output[count[(arr[i] / exp) % 10] - 1] = arr[i]; count[(arr[i] / exp) % 10]--; } for (i = 0; i < n; i++) arr[i] = output[i]; } void radixSort(int arr[], int n) { int m = getMax(arr, n); for (int exp = 1; m / exp > 0; exp *= 10) countSort(arr, n, exp); } int update(int idx, int y) { a[idx] = y; int b[n]; for (int i = 0; i < n; i++) b[i] = a[i]; radixSort(b, n); 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; } int main() { int x[] = {10, 15, 17, 20}; init(4, 10, x); cout << update(2, 16) << endl; }

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

/usr/bin/ld: /tmp/ccxfVXCS.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cct9fE7s.o:elephants.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status