Submission #97080

# Submission time Handle Problem Language Result Execution time Memory
97080 2019-02-13T18:21:15 Z karlopuh Hindeks (COCI17_hindeks) C++14
50 / 50
233 ms 2464 KB
#include <bits/stdc++.h>
using namespace std;

vector< int > cit;
int n;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
	 int broj;
		cin>>broj;
		cit.push_back(broj);
	}
	
	sort(cit.begin(),cit.end());
	int rj = 0;
	for(int i=1;i<=cit.size();i++){
		if(cit[cit.size()-i]>=i){
			rj=i;
		}else{
			cout<<rj;
			return 0;
		}
	}
	
	cout<<rj;
	return 0;
}

Compilation message

hindeks.cpp: In function 'int main()':
hindeks.cpp:17:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<=cit.size();i++){
              ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 44 ms 888 KB Output is correct
9 Correct 233 ms 2464 KB Output is correct
10 Correct 122 ms 1520 KB Output is correct