# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
229342 | DodgeBallMan | Money (IZhO17_money) | C++14 | 1591 ms | 256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int N = 1e6 + 10;
int n, a[N], ans, le = 1;
set<int> s;
vector<pii> all;
int main()
{
scanf("%d",&n);
for( int i = 1 ; i <= n ; i++ ) scanf("%d",&a[i]);
for( int i = 1 ; i <= n ; i++ ) if( a[i] > a[i+1] ) {
all.emplace_back( pii( le, i ) );
le = i + 1;
}
for( int i = all[0].x ; i <= all[0].y ; i++ ) s.insert( a[i] );
for( int i = 1 ; i < all.size() ; i++ ) {
pii x = all[i];
int pt = x.x;
while( pt <= x.y ) {
int val = *s.upper_bound( a[pt] );
while( a[pt] <= val && pt <= x.y ) {
s.insert( a[pt] );
pt++;
}
ans++;
}
}
printf("%d",ans+1);
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... |