| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1329979 | KhoaDuy | Rotating Lines (APIO25_rotate) | C++20 | 3093 ms | 3480 KiB |
#include "rotate.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
//#define endl '\n'
#define ll long long
void energy(int n,vector<int> v){
const int deg90=25000,deg180=50000;
vector<pair<int,int>> order(n);
for(int i=0;i<n;i++){
order[i]={v[i],i};
}
sort(order.begin(),order.end());
while(order.size()>1){
if(order[0].first>=deg90){
for(int i=0;i<order.size()-1-i;i++){
rotate({order[i].second},deg180-(order[i].first-deg90));
rotate({order[order.size()-1-i].second},deg180-order[order.size()-1-i].first);
}
return;
}
vector<int> le,ri;
bool flag=false;
for(int i=1;i<order.size();i++){
if(order[i].first==order[0].first+deg90){
flag=true;
order.erase(order.begin()+i);
break;
}
else if(order[i].first<order[0].first+deg90){
le.push_back(i);
}
else{
ri.push_back(i);
}
}
if(flag){
order.erase(order.begin());
continue;
}
if(le.size()>=ri.size()){
int idx=le.back();
rotate({order[idx].second},order[0].first+deg90-order[idx].first);
order.erase(order.begin()+idx);
}
else{
int idx=ri[0];
rotate({order[idx].second},deg180-(order[idx].first-order[0].first-deg90));
order.erase(order.begin()+idx);
}
order.erase(order.begin());
}
}| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
