# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1128255 | _Temirhan | Money (IZhO17_money) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define sz(x) x.size()
#define F first
#define S second
#define nl '\n'
void Tima()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
const int N = 500 * 500 + 1;
const int inf = 1e12;
const int mod = 1e9 + 7;
signed main()
{
// Tima();
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >>n;
int a[n + 1];
for( int i = 1; i <= n; ++i )
cin >>a[i];
int ans = 0;
multiset< int >s;
s.insert( -inf );
s.insert( inf );
for( int l = 1; l <= n; )
{
++ans;
int r = l;
auto j = s.lower_bound( a[l] );
while( r < n && a[r] <= a[r + 1] && s.lower_bound(a[r + 1]) == j )
++r;
for( int _i = l; _i <= r; ++_i )
s.insert( a[_i] );
l = r + 1;
}
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... |