hiho week 208 register

Ended

Participants:101

Verdict:Accepted
Score:100 / 100
Submitted:2018-06-26 11:16:06

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
int nums[100001];
int main(int argc, char const *argv[]) {
    int length;
    scanf("%d", &length);
    for (int i = 0; i < length; ++i) {
        scanf("%d", &nums[i]);
    }
    int left, right, index, rightMin, leftMax;
    left = 0;
    while (left + 1 < length && nums[left + 1] >= nums[left]) left++;
    leftMax = nums[left];
    rightMin = 100000001;
    index = left;
    while (index < length) {
        rightMin = min(rightMin, nums[index]);
        index++;
    }
    left = 0;
    while (left < length && nums[left] <= rightMin) left++;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX