Submission #143942

#TimeUsernameProblemLanguageResultExecution timeMemory
14394244442Hindeks (COCI17_hindeks)C++11
50 / 50
124 ms5792 KiB
#include <bits/stdc++.h> using namespace std; int n,a[500004],ok; int main (){ ios::sync_with_stdio(0); scanf("%d",&n); for(int i=0;i<n;i++){ scanf("\n%d",&a[i]); } sort(a,a+n); int j=n-1; while(j>-1 and ok+1<=a[j]){ ok++; j--; } printf("%d",ok); return 0; }

Compilation message (stderr)

hindeks.cpp: In function 'int main()':
hindeks.cpp:6:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d",&n);
      ~~~~~^~~~~~~~~
hindeks.cpp:8:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("\n%d",&a[i]);
       ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...