제출 #1206847

#제출 시각아이디문제언어결과실행 시간메모리
1206847friendiksRotating Lines (APIO25_rotate)C++20
컴파일 에러
0 ms0 KiB
#ifndef LOCAL
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC diagnostic ignored "-Wpedantic"
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(52);
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using table = gp_hash_table<T, V>;

using i128 = __int128;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;

const ll INF = 2e18;
const int inf = 2e9;
const int maxn = 1e6;
const int MOD = 1e9 + 7;
const ld pi = acos(-1);
const int P = 5167;
const int L = 26;
const ld EPS = 1e-7;

template<typename T, typename V>
void fill(T &container, V value) {
    for (auto &c: container)
        c = value;
}

#define int ll


void energy(int n, vector<int> v) {
    vector<pair<int, int> > a(n);
    for (int i = 0; i < n; ++i) a[i] = {v[i], i};
    sort(a.begin(), a.end());
    for (int i = n-1; i >= n/2; --i) {
        if (a[i].first < 49999) {
            rotate({a[i].second}, 49999 - a[i].first);
        }
    }
    for (int i = n/2-1; i >= 0; --i) {
        if (a[i].first < 24999) {
            rotate({a[i].second}, 24999 - a[i].first);
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

rotate.cpp: In function 'void energy(ll, std::vector<long long int>)':
rotate.cpp:51:19: error: no matching function for call to 'rotate(<brace-enclosed initializer list>, long long int)'
   51 |             rotate({a[i].second}, 49999 - a[i].first);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from rotate.cpp:7:
/usr/include/c++/11/bits/stl_algo.h:1405:5: note: candidate: 'template<class _FIter> constexpr _FIter std::_V2::rotate(_FIter, _FIter, _FIter)'
 1405 |     rotate(_ForwardIterator __first, _ForwardIterator __middle,
      |     ^~~~~~
/usr/include/c++/11/bits/stl_algo.h:1405:5: note:   template argument deduction/substitution failed:
rotate.cpp:51:19: note:   candidate expects 3 arguments, 2 provided
   51 |             rotate({a[i].second}, 49999 - a[i].first);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rotate.cpp:7:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator)'
  260 | rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last);
      | ^~~~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note:   template argument deduction/substitution failed:
rotate.cpp:51:19: note:   candidate expects 4 arguments, 2 provided
   51 |             rotate({a[i].second}, 49999 - a[i].first);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rotate.cpp:56:19: error: no matching function for call to 'rotate(<brace-enclosed initializer list>, long long int)'
   56 |             rotate({a[i].second}, 24999 - a[i].first);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from rotate.cpp:7:
/usr/include/c++/11/bits/stl_algo.h:1405:5: note: candidate: 'template<class _FIter> constexpr _FIter std::_V2::rotate(_FIter, _FIter, _FIter)'
 1405 |     rotate(_ForwardIterator __first, _ForwardIterator __middle,
      |     ^~~~~~
/usr/include/c++/11/bits/stl_algo.h:1405:5: note:   template argument deduction/substitution failed:
rotate.cpp:56:19: note:   candidate expects 3 arguments, 2 provided
   56 |             rotate({a[i].second}, 24999 - a[i].first);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from rotate.cpp:7:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator)'
  260 | rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last);
      | ^~~~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note:   template argument deduction/substitution failed:
rotate.cpp:56:19: note:   candidate expects 4 arguments, 2 provided
   56 |             rotate({a[i].second}, 24999 - a[i].first);
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~