| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367532 | nagorn_ph | Rotating Lines (APIO25_rotate) | C++20 | 0 ms | 836 KiB |
#include "rotate.h"
#include <bits/stdc++.h>
#define pii pair <int, int>
#define tiii tuple <int, int, int>
#define emb emplace_back
#define all(a) a.begin(), a.end()
using namespace std;
const int N = 2e5 + 5;
// const int inf = 1e18;
void energy(int n, std::vector<int> v){
vector <pii> vv;
for (int i = 0; i < n; i++) vv.emb(v[i], i);
sort(all(vv));
while (vv.size() >= 2) {
pii mid = vv[vv.size()/2 - 1], midd = vv[vv.size()/2];
// cout << mid.second << ", " << midd.second << "\n";
rotate({mid.second}, 50000 - mid.first);
rotate({midd.second}, 25000 - (midd.first % 25000));
vector <pii> nxt = vv;
vv.clear();
for (int i = 0; i < nxt.size(); i++) {
if (i == nxt.size()/2 || i == nxt.size()/2 + 1) continue;
vv.emb(nxt[i]);
}
}
}
/*
25000*n*n/4 = 6250n^2
what if we distribute?
*/| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
