Submission #696228

#TimeUsernameProblemLanguageResultExecution timeMemory
696228iguBest Place (NOI17_bestplace)C++17
Compilation error
0 ms0 KiB
#include<iostream> using namespace std; double median(int arr[], int size){ sort(arr, arr+size); if (size % 2 != 0) return (double)arr[size/2]; return (double)(arr[(size-1)/2] + arr[size/2])/2.0; } int main() { int x; cin >> x; int ans; int bns; int a; int b; int arr[x]; int brr[x]; for (int i = 0; i < x; i++){ cin >> a >> b; arr[i]=a; brr[i]=b; } ans = median(arr,x); bns = median(brr,x); cout << ans << " " << bns; return 0; }

Compilation message (stderr)

bestplace.cpp: In function 'double median(int*, int)':
bestplace.cpp:6:4: error: 'sort' was not declared in this scope; did you mean 'qsort'?
    6 |    sort(arr, arr+size);
      |    ^~~~
      |    qsort