답안 #329144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
329144 2020-11-19T13:11:24 Z poom2904 Mountains (NOI20_mountains) C++11
64 / 100
2000 ms 9316 KB
#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> tem;
    for(int i=2;i<=n;i++)
    {
        tem.insert(upper_bound(tem.begin(),tem.end(),height[i-1]),height[i-1]);
        lower_l[i]=lower_bound(tem.begin(),tem.end(),height[i])-tem.begin();
    }
    tem.clear();
    for(int i=n-1;i>=1;i--)
    {
        tem.insert(upper_bound(tem.begin(),tem.end(),height[i+1]),height[i+1]);
        lower_r[i]=lower_bound(tem.begin(),tem.end(),height[i])-tem.begin();
    }
    ll res=0;
    for(int i=1;i<=n;i++)res+=lower_l[i]*lower_r[i];
    cout<<res;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4972 KB Output is correct
2 Execution timed out 2082 ms 9316 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2081 ms 7272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2081 ms 7272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 4 ms 4972 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 4972 KB Output is correct
10 Correct 4 ms 4972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 4 ms 4972 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 4972 KB Output is correct
10 Correct 4 ms 4972 KB Output is correct
11 Correct 26 ms 5484 KB Output is correct
12 Correct 25 ms 5248 KB Output is correct
13 Correct 25 ms 5228 KB Output is correct
14 Correct 27 ms 5356 KB Output is correct
15 Correct 25 ms 5228 KB Output is correct
16 Correct 31 ms 5228 KB Output is correct
17 Correct 26 ms 5228 KB Output is correct
18 Correct 25 ms 5304 KB Output is correct
19 Correct 24 ms 5356 KB Output is correct
20 Correct 4 ms 4972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2081 ms 7272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4972 KB Output is correct
2 Execution timed out 2082 ms 9316 KB Time limit exceeded
3 Halted 0 ms 0 KB -