Submission #513900

#TimeUsernameProblemLanguageResultExecution timeMemory
513900heroeschargeA Huge Tower (CEOI10_tower)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <fstream> using namespace std; int N, D; int f(int arr[]) { int p1loc = 0; int p1val = 0; int p2loc = 0; int vals[N]; while (p2loc < N) { while (arr[p1loc] <= arr[p2loc] + D && p1loc < N) { p1loc++; p1val++; } vals[p2loc] = p1val; p2loc++; p1val--; } int prod = 1; int M = 1000000009; for (int i = 0; i < N; i++) { prod = (prod * (vals[i] % M)) % M; } return prod; } int main() { cin >> N >> D; int arr[N]; for (int i = 0; i < N; i++) { cin >> arr[i]; } sort(arr, arr + N); cout << f(arr); }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:40:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   40 |     sort(arr, arr + N);
      |     ^~~~
      |     qsort