Submission #1050156

#TimeUsernameProblemLanguageResultExecution timeMemory
1050156mat_jurArt Collections (BOI22_art)C++17
100 / 100
914 ms1808 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; #ifdef DEBUG auto&operator<<(auto &o, pair<auto, auto> p) {o << "(" << p.first << ", " << p.second << ")"; return o;} auto operator<<(auto &o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto e : x) o<<e<<", "; return o<<"}";} #define debug(X) cerr << "["#X"]: " << X << '\n'; #else #define cerr if(0)cout #define debug(X) ; #endif using ll = long long; #define all(v) (v).begin(), (v).end() #define ssize(x) int(x.size()) #define fi first #define se second #define mp make_pair #define eb emplace_back void solve(int n) { vector<int> p(n); iota(all(p), 1); vector<int> idx(n+1, -1); auto query = [&]() { int x = publish(p); int f = p.front(); p.erase(p.begin()); p.eb(f); return mp(x, f); }; auto [prev, a] = query(); for (int i = 0; i < n-1; ++i) { auto [curr, b] = query(); idx[a] = (prev-curr+n-1)/2; prev = curr; a = b; } vector<int> ans(n, -1); for (int i = 1; i <= n; ++i) if (idx[i] != -1) ans[idx[i]] = i; for (int i = 1; i <= n; ++i) { if (idx[i] == -1) { for (int j = 0; j < n; ++j) if (ans[j] == -1) ans[j] = i; } } answer(ans); }

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