Skip to content

Commit 9a6519d

Browse files
authored
[BOJ] 11509 풍선 맞추기 (G5)
1 parent 2b3dab7 commit 9a6519d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

박예진/11주차/260310.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//https://www.acmicpc.net/problem/11509
2+
#include <iostream>
3+
#include <vector>
4+
#include <algorithm>
5+
using namespace std;
6+
7+
int N, answer;
8+
int arrow[1000001]; // 높이별 화살의 개수
9+
10+
int main() {
11+
ios::sync_with_stdio(false);
12+
cin.tie(NULL); cout.tie(NULL);
13+
14+
cin >> N;
15+
for (int i = 0; i < N; i++) {
16+
int h;
17+
cin >> h;
18+
19+
if (arrow[h] > 0) arrow[h]--;
20+
else answer++;
21+
22+
arrow[h - 1]++;
23+
}
24+
cout << answer;
25+
26+
return 0;
27+
}

0 commit comments

Comments
 (0)