# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92497 | Randooom | Money (IZhO17_money) | C++14 | 13 ms | 2296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define in freopen ("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long int
const int val = (1e5) + 5;
const int inf = (1e9) + 7;
double eps = 0.000000001;
using namespace std;
int a[val], ans = 1;
set <int> q;
set <int> :: iterator l, r;
int solve(){
int n;
cin >> n;
for(int i=1; i<=n; ++i){
cin >> a[i];
}
q.insert(0);
q.insert(inf);
l = q.lower_bound(a[1]);
r = q.upper_bound(a[1]);
-- l;
q.insert(a[1]);
for(int i=2; i<=n; ++i){
if(a[i] >= a[i-1] && *l <= a[i] && a[i] <= *r){
q.insert(a[i]);
}
else{
l = q.lower_bound(a[i]);
r = q.upper_bound(a[i]);
-- l;
q.insert(a[i]);
++ ans;
}
}
cout << ans << endl;
}
int main(){
//in out
ios_base::sync_with_stdio(0);
solve();
return 0;
}
컴파일 시 표준 에러 (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... |