Submission #1112380

# Submission time Handle Problem Language Result Execution time Memory
1112380 2024-11-14T07:00:33 Z vjudge1 Baloni (COCI15_baloni) C++17
0 / 100
2000 ms 6584 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int say=0;
	vector<int> a;
	for(int i=0;i<n;i++){
		int x;cin>>x;
		a.push_back(x);
	}
	int mx=*max_element(a.begin(),a.end());
	for(int i=0;a[i]!=-1;i){
		say++;
		int q=1;
		for(int j=i+1;j<n;j++){
			if(a[j]==mx-q){
				q++;
				a[j]=-1;
			}
		}
		a[i]=-1;
		i++;
	}
	cout<<say-1;
	return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:13:23: warning: for increment expression has no effect [-Wunused-value]
   13 |  for(int i=0;a[i]!=-1;i){
      |                       ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Incorrect 3 ms 452 KB Output isn't correct
3 Incorrect 4 ms 336 KB Output isn't correct
4 Incorrect 6 ms 488 KB Output isn't correct
5 Execution timed out 2083 ms 6584 KB Time limit exceeded
6 Execution timed out 2067 ms 6584 KB Time limit exceeded
7 Execution timed out 2066 ms 6584 KB Time limit exceeded
8 Execution timed out 2068 ms 6584 KB Time limit exceeded
9 Incorrect 642 ms 6524 KB Output isn't correct
10 Incorrect 527 ms 4496 KB Output isn't correct