제출 #1124571

#제출 시각아이디문제언어결과실행 시간메모리
1124571thangdz2k7Art Collections (BOI22_art)C++20
컴파일 에러
0 ms0 KiB
// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.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;
//}

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

art.cpp: In function 'void solve(int)':
art.cpp:24:17: error: 'publish' was not declared in this scope
   24 |         rt[i] = publish(ask);
      |                 ^~~~~~~
art.cpp:28:9: error: no matching function for call to 'iota(std::vector<int>::iterator, std::vector<int>::iterator)'
   28 |     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:28:9: note:   candidate expects 3 arguments, 2 provided
   28 |     iota(ord.begin(), ord.end());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:33:5: error: 'answer' was not declared in this scope
   33 |     answer(ord);
      |     ^~~~~~