#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e6 + 10;
int a[mxn], dp[mxn], n;
int main() {
cin >> n;
for(int i = 1; i <= n; i++)
cin >> a[i];
a[0] = 1e9 + 10;
dp[0] = 0;
for(int i = 1; i <= n; i++) {
if(a[i - 1] <= a[i])
dp[i] = dp[i - 1];
else
dp[i] = dp[i - 1] + 1;
}
cout << dp[n] << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |