Submission #97079

# Submission time Handle Problem Language Result Execution time Memory
97079 2019-02-13T18:18:29 Z karlopuh Hindeks (COCI17_hindeks) C++14
40 / 50
233 ms 2500 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 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 128 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 38 ms 1020 KB Output is correct
9 Correct 233 ms 2500 KB Output is correct
10 Incorrect 101 ms 1520 KB Output isn't correct