제출 #1260405

#제출 시각아이디문제언어결과실행 시간메모리
1260405kawhietRotating Lines (APIO25_rotate)C++20
컴파일 에러
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);
    }
}

컴파일 시 표준 에러 (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());
      |          ^