답안 #231579

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231579 2020-05-14T04:01:14 Z huangqr Baloni (COCI15_baloni) C++14
100 / 100
504 ms 632 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
multiset<int>s;

int main(){
	ll n,k,ans;
	cin>>n;
	ans=n;
	for(ll i=0;i<n;i++){
		cin>>k;
		auto it=s.find(k);
		if(it!=s.end()){
			s.insert(*it-1);
			s.erase(it);
			ans--;
		}
		else s.insert(k-1);
	}
	cout<<ans;
	return 0;
}
# 결과 실행 시간 메모리 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 436 KB Output is correct
5 Correct 459 ms 504 KB Output is correct
6 Correct 504 ms 632 KB Output is correct
7 Correct 412 ms 504 KB Output is correct
8 Correct 409 ms 512 KB Output is correct
9 Correct 435 ms 384 KB Output is correct
10 Correct 442 ms 504 KB Output is correct