# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
337581 |
2020-12-21T06:55:36 Z |
boykut |
Money (IZhO17_money) |
C++14 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000001;
int a[MAXN], dp[MAXN];
int ans[301][301];
bool issorted(int l, int r) {
return r - l + 1 <= dp[r];
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
if (n <= 300) {
for (int i = 1; i <= n; i++) {
if (a[i] > a[i - 1])
dp[i] = dp[i - 1] + 1;
else dp[i] = 1;
}
set < int > st;
int ans = 0;
for (int i = 0; i < n; i++) {
auto it = st.upper_bound(a[i]);
if (it != st.end()) ans++;
st.insert(a[i]);
}
cout << ans << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |