이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<long long, int>, null_type, less<pair<long long, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
main(){
ordered_set left1, right1;
int n; cin >> n;
vector<long long> nums;
for (int i = 0; i < n; i++){
long long g; cin >> g;
nums.push_back(g);
right1.insert({g, i});
}
long long ans = 0;
for (int i = 0; i < n; i++){
right1.erase({nums[i], i});
ans += left1.order_of_key({nums[i], 0LL}) * right1.order_of_key({nums[i], 0LL});
left1.insert({nums[i], i});
}
cout << ans << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
Mountains.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |