# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1260405 | kawhiet | Rotating Lines (APIO25_rotate) | C++20 | 0 ms | 0 KiB |
#include "rotate.h"
#include <bits/stdc++.h>
using namespace std;
void energy(int n, vector<int> v){
vector<pair<int,int>> b;
for(int i = 0; i < n; i++){
a.push_back({v[i], i});
}
sort(a.begin(), a.end());
for (int i = 0; i < n / 2; i++){
int x = (b[i].first + 75000 - b[i + (n + 1) / 2].first) % 50000;
rotate({b[i + (n + 1) / 2].second}, x);
}
}