Submission #97078

# Submission time Handle Problem Language Result Execution time Memory
97078 2019-02-13T18:16:02 Z karlopuh Hindeks (COCI17_hindeks) C++14
35 / 50
1000 ms 5936 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++){
		for(int j=cit.size()-1;j>=cit.size()-i;j--){
			if(!(cit[j]>=i)){
				cout<<rj;
				return 0;
			}
		}
		rj=i;
	}
	
	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++){
              ~^~~~~~~~~~~
hindeks.cpp:18:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=cit.size()-1;j>=cit.size()-i;j--){
                          ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 256 KB Output is correct
7 Correct 13 ms 640 KB Output is correct
8 Correct 609 ms 1624 KB Output is correct
9 Execution timed out 1072 ms 5936 KB Time limit exceeded
10 Execution timed out 1079 ms 3176 KB Time limit exceeded