Submission #143942

# Submission time Handle Problem Language Result Execution time Memory
143942 2019-08-15T13:19:08 Z 44442 Hindeks (COCI17_hindeks) C++11
50 / 50
124 ms 5792 KB
#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

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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 392 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 4 ms 504 KB Output is correct
8 Correct 25 ms 1400 KB Output is correct
9 Correct 124 ms 5792 KB Output is correct
10 Correct 61 ms 2996 KB Output is correct