Submission #1277822

#TimeUsernameProblemLanguageResultExecution timeMemory
1277822NValchanovRotating Lines (APIO25_rotate)C++20
Compilation error
0 ms0 KiB
#include "rotate.h"
#include <iostream>

using namespace std;

void energy(int n, vector < int > v)
{
    vector < pair < int, int > > ord;

    for(int i = 0; i < n; i++)
    {
        ord.push_back({v[i], i});
    }

    sort(ord.begin(), ord.end());

    int deg90 = 25000;
    int deg180 = 2 * deg90;

    for(int i = 0; i < n / 2; i++)
    {
        int req = (ord[n - i - 1].first - deg90 + deg180) % deg180;
        int diff = (ord[i].first - req + deg180) % deg180;

        vector < int > q;

        q.push_back(i);

        rotate(q, diff);
    }
}

Compilation message (stderr)

rotate.cpp: In function 'void energy(int, std::vector<int>)':
rotate.cpp:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(ord.begin(), ord.end());
      |     ^~~~
      |     short