답안 #1112399

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112399 2024-11-14T07:14:52 Z vjudge1 Baloni (COCI15_baloni) C++17
40 / 100
2000 ms 7248 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

int n,ok,sum=0,eksi,ilk=0;

int32_t main() {
	cin>>n;
	eksi=n;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	while(eksi>0){
		sum++;
		ok=arr[ilk];
		ilk=0;
		for(int i=0;i<n;i++){
		if(ok==arr[i]){
			arr[i]=-1;
			eksi--;
			ok--;
		}
		else if(ilk==0 && ok!=arr[i] && arr[i]!=-1){
			ilk=i;
		}
		}
	}
	cout<<sum;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 7 ms 336 KB Output is correct
4 Correct 11 ms 336 KB Output is correct
5 Execution timed out 2080 ms 6480 KB Time limit exceeded
6 Execution timed out 2055 ms 7248 KB Time limit exceeded
7 Execution timed out 2045 ms 5968 KB Time limit exceeded
8 Execution timed out 2074 ms 5968 KB Time limit exceeded
9 Execution timed out 2053 ms 6224 KB Time limit exceeded
10 Execution timed out 2057 ms 6480 KB Time limit exceeded