| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 329145 | poom2904 | Mountains (NOI20_mountains) | C++11 | 2075 ms | 9364 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int n;
vector<ll> height(300001);
vector<int> lower_l(300001,0);
vector<int> lower_r(300001,0);
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++)cin>>height[i];
vector<ll> tem1,tem2;
for(int i=2;i<=n;i++)
{
tem1.insert(upper_bound(tem1.begin(),tem1.end(),height[i-1]),height[i-1]);
lower_l[i]=lower_bound(tem1.begin(),tem1.end(),height[i])-tem1.begin();
}
for(int i=n-1;i>=1;i--)
{
tem2.insert(upper_bound(tem2.begin(),tem2.end(),height[i+1]),height[i+1]);
lower_r[i]=lower_bound(tem2.begin(),tem2.end(),height[i])-tem2.begin();
}
ll res=0;
for(int i=1;i<=n;i++)res+=lower_l[i]*lower_r[i];
cout<<res;
return 0;
}
| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
