Submission #857615

#TimeUsernameProblemLanguageResultExecution timeMemory
857615vgtcrossArt Collections (BOI22_art)C++17
100 / 100
1249 ms1852 KiB
#include <bits/stdc++.h>

#define MODE 0

using namespace std;
using ll = long long;

int publish(vector<int> r)
#if MODE
{
    cout << "? ";
    for (int i : r) cout << i << ' ';
    cout << endl;
    int ans;
    cin >> ans;
    return ans;
}
#else
;
#endif

void answer(vector<int> r)
#if MODE
{
    cout << "! ";
    for (int i : r) cout << i << ' ';
    cout << endl;
}
#else
;
#endif

void solve(int n) {
    vector<int> v(n);
    vector<int> r(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) r[j] = (i+j) % n + 1;
        v[i] = publish(r);
    }
    
    vector<int> ans(n);
    for (int i = 0; i < n; ++i) {
        ans[(v[i] - v[(i+1)%n] + n - 1) / 2] = i+1;
    }
    answer(ans);
}

#if MODE
int main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    solve(n);
}
#endif

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...