답안 #259695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259695 2020-08-08T09:58:17 Z IOrtroiii Mountains (NOI20_mountains) C++14
24 / 100
797 ms 24568 KB
#include <bits/stdc++.h>

#include <ext/pb_ds/tree_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

using namespace __gnu_pbds;

template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int N; cin >> N;
   vector<int> H(N);
   for (int i = 0; i < N; ++i) cin >> H[i];
   vector<int> L(N), R(N);
   ordered_set<pair<int, int>> st;
   for (int i = 0; i < N; ++i) {
      L[i] = st.order_of_key({H[i], -1});
      st.insert({H[i], i});
   }
   st.clear();
   for (int i = N - 1; i >= 0; --i) {
      R[i] = st.order_of_key({H[i], -1});
      st.insert({H[i], i});
   }
   int64_t ans = 0;
   for (int i = 0; i < N; ++i) ans += int64_t(L[i]) * R[i];
   cout << ans << '\n';
   return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 446 ms 22820 KB Output is correct
3 Correct 449 ms 22768 KB Output is correct
4 Correct 450 ms 22776 KB Output is correct
5 Correct 465 ms 22648 KB Output is correct
6 Correct 456 ms 22648 KB Output is correct
7 Correct 449 ms 22648 KB Output is correct
8 Correct 444 ms 22796 KB Output is correct
9 Correct 449 ms 22776 KB Output is correct
10 Correct 445 ms 22648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 23336 KB Output is correct
2 Correct 320 ms 23288 KB Output is correct
3 Correct 322 ms 23488 KB Output is correct
4 Correct 322 ms 23424 KB Output is correct
5 Correct 318 ms 23308 KB Output is correct
6 Correct 334 ms 23288 KB Output is correct
7 Correct 342 ms 23396 KB Output is correct
8 Correct 470 ms 23216 KB Output is correct
9 Correct 474 ms 23416 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 23336 KB Output is correct
2 Correct 320 ms 23288 KB Output is correct
3 Correct 322 ms 23488 KB Output is correct
4 Correct 322 ms 23424 KB Output is correct
5 Correct 318 ms 23308 KB Output is correct
6 Correct 334 ms 23288 KB Output is correct
7 Correct 342 ms 23396 KB Output is correct
8 Correct 470 ms 23216 KB Output is correct
9 Correct 474 ms 23416 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 634 ms 23544 KB Output is correct
12 Correct 651 ms 23584 KB Output is correct
13 Correct 616 ms 23544 KB Output is correct
14 Correct 592 ms 23544 KB Output is correct
15 Correct 583 ms 23544 KB Output is correct
16 Correct 580 ms 23544 KB Output is correct
17 Correct 581 ms 23544 KB Output is correct
18 Correct 497 ms 23544 KB Output is correct
19 Correct 478 ms 23544 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 23336 KB Output is correct
2 Correct 320 ms 23288 KB Output is correct
3 Correct 322 ms 23488 KB Output is correct
4 Correct 322 ms 23424 KB Output is correct
5 Correct 318 ms 23308 KB Output is correct
6 Correct 334 ms 23288 KB Output is correct
7 Correct 342 ms 23396 KB Output is correct
8 Correct 470 ms 23216 KB Output is correct
9 Correct 474 ms 23416 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 634 ms 23544 KB Output is correct
12 Correct 651 ms 23584 KB Output is correct
13 Correct 616 ms 23544 KB Output is correct
14 Correct 592 ms 23544 KB Output is correct
15 Correct 583 ms 23544 KB Output is correct
16 Correct 580 ms 23544 KB Output is correct
17 Correct 581 ms 23544 KB Output is correct
18 Correct 497 ms 23544 KB Output is correct
19 Correct 478 ms 23544 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 740 ms 24348 KB Output is correct
22 Correct 654 ms 24440 KB Output is correct
23 Correct 735 ms 24440 KB Output is correct
24 Correct 719 ms 24356 KB Output is correct
25 Correct 726 ms 24440 KB Output is correct
26 Correct 797 ms 24568 KB Output is correct
27 Correct 755 ms 24568 KB Output is correct
28 Correct 541 ms 24568 KB Output is correct
29 Correct 531 ms 24440 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 446 ms 22820 KB Output is correct
3 Correct 449 ms 22768 KB Output is correct
4 Correct 450 ms 22776 KB Output is correct
5 Correct 465 ms 22648 KB Output is correct
6 Correct 456 ms 22648 KB Output is correct
7 Correct 449 ms 22648 KB Output is correct
8 Correct 444 ms 22796 KB Output is correct
9 Correct 449 ms 22776 KB Output is correct
10 Correct 445 ms 22648 KB Output is correct
11 Correct 317 ms 23336 KB Output is correct
12 Correct 320 ms 23288 KB Output is correct
13 Correct 322 ms 23488 KB Output is correct
14 Correct 322 ms 23424 KB Output is correct
15 Correct 318 ms 23308 KB Output is correct
16 Correct 334 ms 23288 KB Output is correct
17 Correct 342 ms 23396 KB Output is correct
18 Correct 470 ms 23216 KB Output is correct
19 Correct 474 ms 23416 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 634 ms 23544 KB Output is correct
22 Correct 651 ms 23584 KB Output is correct
23 Correct 616 ms 23544 KB Output is correct
24 Correct 592 ms 23544 KB Output is correct
25 Correct 583 ms 23544 KB Output is correct
26 Correct 580 ms 23544 KB Output is correct
27 Correct 581 ms 23544 KB Output is correct
28 Correct 497 ms 23544 KB Output is correct
29 Correct 478 ms 23544 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Incorrect 1 ms 384 KB Output isn't correct
32 Halted 0 ms 0 KB -