Submission #1112518

# Submission time Handle Problem Language Result Execution time Memory
1112518 2024-11-14T09:23:27 Z vjudge1 Baloni (COCI15_baloni) C++17
40 / 100
2000 ms 7500 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

int32_t main(){
	int n;
	cin>>n;
	vector<int> v(n);
	int ans=1;
	map<int,int> mp;
	mp[1]=v[0];
	for(int i=0; i<n; i++){
		bool hit=false;
		cin>>v[i];
		if(i==0) mp[1]=v[i];
		else{
			for(int x=1; x<=ans; x++){
			if(mp[x]==v[i]+1){
				mp[x]--;
				hit=true;
				break;
			}
		}
			if(!hit){
				ans++;
				mp[ans]=v[i];
		
			}
		}
	}
	cout<<ans<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 336 KB Output is correct
2 Correct 11 ms 496 KB Output is correct
3 Correct 32 ms 336 KB Output is correct
4 Correct 44 ms 592 KB Output is correct
5 Execution timed out 2082 ms 6480 KB Time limit exceeded
6 Execution timed out 2051 ms 7500 KB Time limit exceeded
7 Execution timed out 2077 ms 6332 KB Time limit exceeded
8 Execution timed out 2069 ms 6176 KB Time limit exceeded
9 Execution timed out 2063 ms 6480 KB Time limit exceeded
10 Execution timed out 2071 ms 6740 KB Time limit exceeded