Submission #438996

# Submission time Handle Problem Language Result Execution time Memory
438996 2021-06-29T03:32:22 Z Hausdorf Mountains (NOI20_mountains) C++17
64 / 100
2000 ms 10436 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define itn int
#define fi first
#define se second
#pragma optimizatiob ("O3")
#pragma GCC target ("avx2")
#pragma optimization ("unroll_loops")

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    vector<ll> h(n + 2);
    for (int i = 1; i <= n; ++i)
        cin >> h[i];
    h[0] = h[n + 1] = -2e9;
    vector<int> lessleft(n + 2, 0), lessright(n + 2, 0);
    //lessleft[0] = -1; lessright[n + 1] = -1;
    lessleft[1] = lessright[n] = 0;
    for (int i = 2; i <= n; ++i) {
        for (int j = 1; j < i; ++j) {
            if (h[j] < h[i])
                ++lessleft[i];
        }
    }
    for (int i = n - 1; i >= 1; --i) {
        for (int j = n; j > i; --j) {
            if (h[j] < h[i])
                ++lessright[i];
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; ++i)
        ans += 1ll * lessleft[i] * lessright[i];
    cout << ans;
}

Compilation message

Mountains.cpp:8: warning: ignoring '#pragma optimizatiob ' [-Wunknown-pragmas]
    8 | #pragma optimizatiob ("O3")
      | 
Mountains.cpp:10: warning: ignoring '#pragma optimization ' [-Wunknown-pragmas]
   10 | #pragma optimization ("unroll_loops")
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 2098 ms 10436 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2088 ms 5468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2088 ms 5468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 363 ms 636 KB Output is correct
12 Correct 365 ms 632 KB Output is correct
13 Correct 392 ms 640 KB Output is correct
14 Correct 366 ms 640 KB Output is correct
15 Correct 361 ms 632 KB Output is correct
16 Correct 357 ms 640 KB Output is correct
17 Correct 360 ms 636 KB Output is correct
18 Correct 374 ms 636 KB Output is correct
19 Correct 372 ms 488 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2088 ms 5468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 2098 ms 10436 KB Time limit exceeded
3 Halted 0 ms 0 KB -