Submission #960229

# Submission time Handle Problem Language Result Execution time Memory
960229 2024-04-10T00:18:22 Z ezzzay Baloni (COCI15_baloni) C++14
40 / 100
53 ms 7152 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
int a[N];
bool vis[N];
signed main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int p=0;
	int cnt=n;
	while(cnt>0){
		int cur=-1;
		for(int i=n;i>=1;i--){
			if(vis[i]==0){
				if(cur==-1){
					cur=a[i];
					vis[i]=1;
					cnt--;
					continue;
				}
				if(cur==a[i]-1){
					cur=a[i];
					vis[i]=1;
					cnt--;
				}
			}
		}
		p++;
	}
	cout<<p;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2392 KB Output is correct
2 Correct 5 ms 2396 KB Output is correct
3 Correct 10 ms 2508 KB Output is correct
4 Correct 15 ms 2396 KB Output is correct
5 Runtime error 53 ms 7068 KB Execution killed with signal 11
6 Runtime error 47 ms 6740 KB Execution killed with signal 11
7 Runtime error 47 ms 6808 KB Execution killed with signal 11
8 Runtime error 46 ms 6812 KB Execution killed with signal 11
9 Runtime error 49 ms 7152 KB Execution killed with signal 11
10 Runtime error 50 ms 6696 KB Execution killed with signal 11