We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b3dab7 commit 9a6519dCopy full SHA for 9a6519d
1 file changed
박예진/11주차/260310.cpp
@@ -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