Submission #1124572

#TimeUsernameProblemLanguageResultExecution timeMemory
1124572thangdz2k7Art Collections (BOI22_art)C++20
Compilation error
0 ms0 KiB
// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#include "art.h"
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int MaxN = 2e5;
const int mod = 1e9 + 7;


void solve(int n){
    vector <int> rt(n);
    for (int i = 0; i < n; ++ i){
        vector <int> ask(n);
        for (int j = 0; j < n; ++ j) ask[j] = (i + j) % n + 1;
        rt[i] = publish(ask);
    }

    vector <int> ord(n);
    iota(ord.begin(), ord.end());
    sort(ord.begin(), ord.end(), [&](int u, int v){
        return rt[u] - rt[(u + 1) % n] < rt[v] - rt[(v + 1) % n];
    });
    for (int &f : ord) f ++;
    answer(ord);
}

//int main(){
//    if (fopen("pqh.inp", "r")){
//        freopen("pqh.inp", "r", stdin);
//        freopen("pqh.out", "w", stdout);
//    }
//    ios_base::sync_with_stdio(0);
//    cin.tie(0); cout.tie(0);
//
//    int t = 1; // cin >> t;
//    while (t --) solve();
//    return 0;
//}

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:29:9: error: no matching function for call to 'iota(std::vector<int>::iterator, std::vector<int>::iterator)'
   29 |     iota(ord.begin(), ord.end());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:84,
                 from art.cpp:4:
/usr/include/c++/11/bits/stl_numeric.h:88:5: note: candidate: 'template<class _ForwardIterator, class _Tp> constexpr void std::iota(_ForwardIterator, _ForwardIterator, _Tp)'
   88 |     iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
      |     ^~~~
/usr/include/c++/11/bits/stl_numeric.h:88:5: note:   template argument deduction/substitution failed:
art.cpp:29:9: note:   candidate expects 3 arguments, 2 provided
   29 |     iota(ord.begin(), ord.end());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~