| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 977152 | Isam | Money (IZhO17_money) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define eb emplace_back
constexpr int sz = 1e6 + 6;
constexpr int inf = (int)1E9 + 7;
int n, a[sz], ans;
vector<pair<vector<int>, pair<int, int>>> vos;
signed main(){
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n;
for(register int i = 1; i <= n; ++i){
cin >> a[i];
}
int l(1);
a[n+1] = -inf;
for(register int i = 1; i <= n + 1; ++i){
if(a[i] < a[i-1]){
vector<int> opi;
for(register int j = l; j < i; ++j){
opi.eb(a[j]);
}
vos.eb((pair<vector<int>, pair<int, int>>){opi, {l, i-1}});
++ans;
l = i;
}
}
// for(auto to : vos){
//
// for(auto too : to) cerr << too << ' ';
// cout << '\n';
// }
for(auto to : vos){
pair<int, int> ro = to.second;
int l = ro.first, r = ro.second;
int lo = a[l], hi = a[r];
for(register int i = 1; i < l; ++i){
if(a[i] > lo && a[i] < hi){
lo = a[i];
++ans;
}
}
}
cout << ans << '\n';
}컴파일 시 표준 에러 (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... | ||||
