Submission #697161

#TimeUsernameProblemLanguageResultExecution timeMemory
697161noobnessOVERLOADEDBest Place (NOI17_bestplace)C++14
100 / 100
90 ms3100 KiB
#include<bits/stdc++.h> 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 n; cin >> n; int arr[n]; int brr[n]; int a; int b; int ans; int bns; for(int i = 0; i<n; i++){ cin >> a >> b; arr[i] = a; brr[i] = b; } ans = median(arr,n); bns = median(brr,n); cout << ans << " " << bns; return 0; }

Compilation message (stderr)

bestplace.cpp: In function 'double median(int*, int)':
bestplace.cpp:6:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    6 |   if(size % 2!=0)
      |   ^~
bestplace.cpp:8:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    8 |     return (double)(arr[(size-1)/2]+arr[size/2])/2.0;
      |     ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...