| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366896 | mrasool1665 | Rotating Lines (APIO25_rotate) | C++20 | 3094 ms | 2600 KiB |
//MRasool kheyri
//Iran -> Khorasan -> Ferdown -> Baghestan
//17/2/1405
//vasate azmoonima...
#include<bits/stdc++.h>
#include "rotate.h"
using namespace std ;
typedef long long ll ;
#define el '\n'
const ll maxn = 2e6 + 100 ;
const ll x = 50000 ;
ll mark[maxn] ;
vector<int> vec[maxn] ;
void energy(int n , vector<int> v){
for(ll i = 0 ; i < n ; i++){
vec[v[i]].push_back(i) ;
}
ll ok = 1 ;
while(ok){
ok = 0 ;
for(ll i = 0 ; i < x ; i++){
if(!vec[i].size()){continue;}
ll cnt1 = 0 , cnt2 = 0 ;
for(ll b = 0 ; b < ll(v.size()) ; b++){
if(v[b] == (i+x/2)%x || v[b] == i){continue;}
ll x1 = 0 , x2 = 0 ;
if(i < v[b]){
x2 = v[b]-i ;
x1 = x-x2 ;
}
else{
x1 = i-v[b] ;
x2 = x-x1 ;
}
if(x1 < x2){
cnt1++ ;
}
else{
cnt2++ ;
}
}
if(cnt1 < cnt2){
rotate(vec[i],x-1) ;
while(vec[i].size()){
ll A = vec[i].back() ;
vec[i].pop_back() ;
v[A] = (i+x-1)%x ;
vec[(i+x-1)%x].push_back(A) ;
}
ok = 1 ;
break ;
}
else if(cnt1 > cnt2){
rotate(vec[i],1) ;
while(vec[i].size()){
ll A = vec[i].back() ;
vec[i].pop_back() ;
v[A] = (i+1)%x ;
vec[(i+1)%x].push_back(A) ;
}
ok = 1 ;
break ;
}
}
}
return ;
}| # | 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... | ||||
