Submission #1257866

#TimeUsernameProblemLanguageResultExecution timeMemory
1257866noopRotating Lines (APIO25_rotate)C++20
Compilation error
0 ms0 KiB
#include "rotate.h"
#include <bits/stdc++.h>
using namespace std;
void energy(int n,vector<int> v){
    pair<int,int> r[n];
    for (int i=0; i<n; ++i)
        r[i]={v[i],i};
    sort(r.begin(),r.end());
    n>>=1;
    for (int i=0; i<n; ++i)
        rotate({r[i+n].second},r[i].first+25000-r[i+n].first);
}

Compilation message (stderr)

rotate.cpp: In function 'void energy(int, std::vector<int>)':
rotate.cpp:8:12: error: request for member 'begin' in 'r', which is of non-class type 'std::pair<int, int> [n]'
    8 |     sort(r.begin(),r.end());
      |            ^~~~~
rotate.cpp:8:22: error: request for member 'end' in 'r', which is of non-class type 'std::pair<int, int> [n]'
    8 |     sort(r.begin(),r.end());
      |                      ^~~