| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 156172 | theboatman | Money (IZhO17_money) | C++17 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define y1 theboatman
#define make_struct(args...) {args}
using namespace std;
int main() {
cin.tie(0);
ios :: sync_with_stdio(0);
int n;
cin >> n;
vector <int> a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
int now = 0, x = 0;
while(now < n && x <= a[now]) {
x = a[now];
now++;
}
set <int> bank;
for(int i = 0; i < now; i++) {
bank.insert(a[i]);
}
int ans = 0;
for(int i = now; i < n; i++) {
if (a[i] >= *--bank.end()) {
int x = a[i];
while(i < n && x <= a[i]) {
x = a[i];
bank.insert(x);
i++;
}
i--;
}
else {
if (a[i] < *bank.begin()) {
int x = a[i];
while(i < n && x <= a[i] && a[i] <= *bank.begin()) {
x = a[i];
bank.insert(x);
i++;
}
i--;
}
else {
int x = a[i];
while(i < n && x <= a[i] && a[i] <= *--bank.end()) {
x = a[i];
bank.insert(x);
i++;
}
i--;
}
}
ans++;
}
cout << ans << "\n";
return 0;
}
/*
1 5 6
*/
| # | 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... | ||||
