답안 #487216

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
487216 2021-11-14T20:10:57 Z Karuk Climbers (RMI18_climbers) C++14
0 / 100
800 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
void solve()
{
    int n;
    cin>>n;
    vector<int>a(n);
    int maxi=0,sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(i>0)
        {
            sum+=abs(a[i]-a[i-1]);
            maxi=max(maxi,abs(a[i]-a[i-1]));
        }
        if(i>0 && i<n-1)
        {
            if(a[i]>a[i-1] && a[i+1]>a[i])for(;;);
            if(a[i]<a[i-1]&&a[i+1]<a[i])for(;;);
        }
    }
    cout<<sum-maxi<<endl;
}
int main()
{
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1046 ms 204 KB Time limit exceeded
2 Execution timed out 1083 ms 204 KB Time limit exceeded
3 Execution timed out 1091 ms 204 KB Time limit exceeded
4 Execution timed out 1086 ms 204 KB Time limit exceeded
5 Execution timed out 1088 ms 204 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 204 KB Time limit exceeded
2 Execution timed out 1086 ms 204 KB Time limit exceeded
3 Execution timed out 1092 ms 204 KB Time limit exceeded
4 Execution timed out 1095 ms 204 KB Time limit exceeded
5 Execution timed out 1083 ms 204 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 204 KB Time limit exceeded
2 Execution timed out 1091 ms 204 KB Time limit exceeded
3 Execution timed out 1090 ms 204 KB Time limit exceeded
4 Execution timed out 1076 ms 204 KB Time limit exceeded
5 Execution timed out 1084 ms 204 KB Time limit exceeded
6 Execution timed out 1089 ms 204 KB Time limit exceeded
7 Execution timed out 1090 ms 204 KB Time limit exceeded
8 Execution timed out 1081 ms 204 KB Time limit exceeded
9 Execution timed out 1081 ms 204 KB Time limit exceeded
10 Execution timed out 1090 ms 204 KB Time limit exceeded