#include <bits/stdc++.h>
#define REP(v, i, j) for (long long v = i; v != j; v++)
#define FORI(v) for (auto i : v)
#define FORJ(v) for (auto j : v)
#define OUT(v, a) FORI(v) cout << i << a;
#define OUTS(v, a, b) cout << v.size() << a; OUT(v, b)
#define in(a, n) REP(i, 0, n) cin >> a[i];
#define SORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define pb push_back
#define fi first
#define se second
#define detachIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef pair<long long, long long> pii;
typedef pair<pii, long long> piii;
typedef pair<pii, pii> piiii;
set<long long> st;
vector<long long> v;
int main()
{
detachIO;
long long N;
cin >> N;
while (N--)
{
long long x;
cin >> x;
if (st.lower_bound(x) != st.end())
v.pb(*st.lower_bound(x));
else
v.pb(1E10);
st.insert(x);
// cout << v.back() << ' ';
}
long long c = 1E11;
long long ans = 0;
FORI(v)
{
if (c > i)
ans++;
c = i;
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |