답안 #231184

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231184 2020-05-13T02:38:32 Z palpatinezw Baloni (COCI15_baloni) C++14
100 / 100
363 ms 10360 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N, h[1000005];
multiset<int> s;

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	int c = 0;
	for (int i = 0; i < N; i++) {
		if (s.find(h[i] + 1) == s.end()) c++;
		else s.erase(s.find(h[i] + 1));
		s.insert(h[i]);
	}
	cout << c;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 295 ms 9592 KB Output is correct
6 Correct 363 ms 10360 KB Output is correct
7 Correct 293 ms 8696 KB Output is correct
8 Correct 292 ms 8312 KB Output is correct
9 Correct 304 ms 9080 KB Output is correct
10 Correct 314 ms 9208 KB Output is correct