| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 362853 | shahriarkhan | Money (IZhO17_money) | C++14 | 210 ms | 15084 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std ;
const int mx = 1e6 + 45 ;
int T[mx] ;
void add(int pos)
{
for(; pos < mx ; pos += (pos & -pos)) ++T[pos] ;
}
int get(int pos)
{
int res = 0 ;
for(; pos > 0 ; pos -= (pos & -pos)) res += T[pos] ;
return res ;
}
int find_max(int l , int r)
{
if(l>r) return 0 ;
return get(r) - get(l-1) ;
}
int main()
{
int n ;
scanf("%d",&n) ;
int a[n+1] , ans = 0 ;
for(int i = 1 ; i <= n ; ++i) scanf("%d",&a[i]) ;
for(int i = 1 ; i <= n ; ++i)
{
int ed = i ;
while(((ed+1)<=n) && ((a[ed+1]>=a[ed]) && (!find_max(a[i]+1,a[ed+1]-1)))) ++ed ;
++ans ;
for(int j = i ; j <= ed ; ++j) add(a[j]) ;
i = ed ;
}
printf("%d\n",ans) ;
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... | ||||
