| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 377229 | CaroLinda | Money (IZhO17_money) | C++14 | 270 ms | 15132 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x.size() )
#define lp(i,a,b) for(int i = a; i< b ; i++ )
#define pii pair<int,int>
const int MAXN = 1e6+10 ;
using namespace std ;
int N ;
int arr[MAXN] ;
int bit[MAXN] ;
void upd(int pos, int x ) { for(; pos < MAXN ; pos += pos & -pos ) bit[pos] += x ; }
int qry(int pos)
{
int tot = 0 ;
for(; pos > 0 ; pos -= pos & -pos ) tot += bit[pos] ;
return tot ;
}
int main()
{
scanf("%d", &N ) ;
for(int i= 1 ; i <= N ; i++ )
{
scanf("%d", &arr[i] ) ;
upd(arr[i], 1) ;
}
int ans = 0 ;
for(int i = N ; i > 0 ; ans++ )
{
upd(arr[i], -1 ) ;
int j = i-1 ;
while( j > 0 && arr[j] <= arr[j+1] )
{
if( qry(arr[i]-1) - qry(arr[j] ) > 0 ) break ;
upd(arr[j] , -1 ) ;
j-- ;
}
i = j ;
}
printf("%d\n", 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... | ||||
