# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
372223 | dolphingarlic | Group Photo (JOI21_ho_t3) | C++14 | 1100 ms | 752 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int n, pos[5001], dp[5001], bit1[5001], bit2[5001];
void update(int *bit, int pos, int val) {
for (; pos <= n; pos += pos & -pos) bit[pos] += val;
}
int query(int *bit, int a, int b) {
int ans = 0;
for (; b; b -= b & -b) ans += bit[b];
for (a--; a; a -= a & -a) ans -= bit[a];
return ans;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; i++) {
int a;
cin >> a;
pos[a] = i;
}
for (int i = 1; i <= n; i++) {
dp[i] = INT_MAX;
// First, get inversions from [1; i]
int inversions = 0;
for (int j = 1; j <= i; j++) {
# | 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... |