Submission #951620

# Submission time Handle Problem Language Result Execution time Memory
951620 2024-03-22T07:47:48 Z phoenix0423 Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second

void solve(int n){
    vector<int> p(n), ans(n, -1);
    iota(p.begin(), p.end(), 1);
    int prv = 0;
    for(int i = 0; i < n; i++){
        int cur = publish(p);
        if(i){
            ans[(n - 1 - (cur - prv)) / 2] = p[n - 1];
        }
        prv = cur;
        p.pb(p.front());
        p.erase(p.begin());
    }
    for(int i = 0; i < n; i++){
        if(ans[i] == -1){
            ans[i] = p[n - 1];
            break;
        }
    }
    answer(ans);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:16:19: error: 'publish' was not declared in this scope
   16 |         int cur = publish(p);
      |                   ^~~~~~~
art.cpp:30:5: error: 'answer' was not declared in this scope
   30 |     answer(ans);
      |     ^~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~