# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
671803 | viwlesxq | Money (IZhO17_money) | C++17 | 910 ms | 51280 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef string str;
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
void freo(str x) {freopen((x + ".in").c_str(), "r", stdin);freopen((x + ".out").c_str(), "w", stdout);}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
int ans = 1;
multiset <int> st;
st.insert(a[0]);
auto it = st.end();
for (int i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
ans++;
it = st.upper_bound(a[i]);
}
else {
auto itu = st.upper_bound(a[i]);
auto itl = st.lower_bound(a[i]);
if (itu != it && itl != it) {
ans++;
it = itu;
}
}
st.insert(a[i]);
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |