Submission #232941

#TimeUsernameProblemLanguageResultExecution timeMemory
232941kristopher23Mountains (NOI20_mountains)C++17
64 / 100
2092 ms2688 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<ll>; using pi = pair<int, int>; using pll = pair<ll, ll>; constexpr auto MOD = 1e9 + 7; constexpr auto INF = 0x3f3f3f3f; #define rep(i, a, b) for (auto i = a; i < b; ++i) template <class T> inline T square(T x) { return x * x; }; template <class T> void print(const T &val) { cout << val << '\n'; } template <class Iterator> void print(Iterator begin, Iterator end) { for (auto it = begin; it != end; ++it) { cout << *it << ' '; } cout << '\n'; } using ull = unsigned long long; int main() { ios::sync_with_stdio(0); cin.tie(0); ull n; cin >> n; vector<ull> a(n); for (auto &i : a) { cin >> i; } ull ans = 0; for (ull i = 1; i < n - 1; ++i) { ull x = 0, y = 0; for (ull j = 0; j < i; ++j) { if (a[j] < a[i]) { ++x; } } for (ull j = i + 1; j < n; ++j) { if (a[j] < a[i]) { ++y; } } ans += (x * y); } print(ans); }
#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...