Submission #438996

#TimeUsernameProblemLanguageResultExecution timeMemory
438996HausdorfMountains (NOI20_mountains)C++17
64 / 100
2098 ms10436 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...