| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 710095 | hpesoj | Money (IZhO17_money) | C++17 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define pi pair <int, int>
#define ppi pair <pi, int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
const int inf = 1000000000;
int n, a[1000005], prefmax[1000005], prefmin[1000005];
signed main(){
ios::sync_with_stdio(0), cin.tie(0);
cin >> n;
prefmin[0] = inf;
for(int i = 1; i <= n; i++){
cin >> a[i];
prefmax[i] = max(prefmax[i-1], a[i]);
prefmin[i] = min(prefmin[i-1], a[i]);
}
int ans = 1;
int l = 1;
for(int i = 2; i <= n; i++){
if(ans == 1 and a[i] < a[i-1]){
ans++;
//for(int j = l; j < i; j++) cout << a[j] << ' ';
//cout << '\n';
//l = i;
}
else if(ans != 1 and (a[i] < a[i-1] or a[i] < prefmin[i-1] or a[i] > prefmax[i-1])){
ans++;
//for(int j = l; j < i; j++) cout << a[j] << ' ';
//cout << '\n';
//l = 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... | ||||
