Submission #1260405

#TimeUsernameProblemLanguageResultExecution timeMemory
1260405kawhietRotating 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){
    vector<pair<int,int>> b;
    for(int i = 0; i < n; i++){
        a.push_back({v[i], i});
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n / 2; i++){
        int x = (b[i].first + 75000 - b[i + (n + 1) / 2].first) % 50000;
        rotate({b[i + (n + 1) / 2].second}, x);
    }
}

Compilation message (stderr)

rotate.cpp: In function 'void energy(int, std::vector<int>)':
rotate.cpp:8:9: error: 'a' was not declared in this scope
    8 |         a.push_back({v[i], i});
      |         ^
rotate.cpp:10:10: error: 'a' was not declared in this scope
   10 |     sort(a.begin(), a.end());
      |          ^