Submission #231287

# Submission time Handle Problem Language Result Execution time Memory
231287 2020-05-13T10:00:57 Z origami100 Baloni (COCI15_baloni) C++11
100 / 100
516 ms 544 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	cin >> n;
	multiset <ll> num;
	for(ll i = 0; i < n; i++){
		ll a;
		cin >> a;
		if(num.empty()){
			num.insert(a);
		}else{
			multiset <ll>::iterator it;
			it = num.lower_bound(a + 1);
			if(it == num.end()){
				num.insert(a);
			}else if(*it == a + 1){
				num.erase(it);
				num.insert(a);
			}else{
				num.insert(a);
			}
		}
	}
	cout << num.size();
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 458 ms 420 KB Output is correct
6 Correct 516 ms 492 KB Output is correct
7 Correct 413 ms 504 KB Output is correct
8 Correct 418 ms 544 KB Output is correct
9 Correct 455 ms 504 KB Output is correct
10 Correct 452 ms 508 KB Output is correct