Submission #893823

#TimeUsernameProblemLanguageResultExecution timeMemory
8938231binArt Collections (BOI22_art)C++17
100 / 100
1187 ms1636 KiB
#include <bits/stdc++.h>
#include "art.h"

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
int n, x, b;

/*
int publish(vector<int> v){
    for(int& x : v) cout << x << ' ';
    cout << endl;
    int ret;
    cin >> ret;
     return ret;
}
void answer(vector<int> v){
    for(int& x : v) cout << x << ' ';
    cout << endl;
    return;
}
*/

void solve(int n) {
    vector<int> v, ans(n);
    for(int i = 1; i <= n; i++) v.emplace_back(i);
    b = publish(v);
    for(int i = 1; i < n; i++){
        for(int j = 0; j < n; j++) 
            v[j] = v[j] == n ? 1 : v[j] + 1;
        x = publish(v);
        ans[(n - 1 - x + b) / 2] = i;
        b = x;
    }
    for(int i = 0; i < n; i++)
        if(!ans[i]) ans[i] = n;
    answer(ans);
}

/*
int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    solve(n);   
    return 0;
}
*/

Compilation message (stderr)

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) {
      |        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...