Submission #1062440

#TimeUsernameProblemLanguageResultExecution timeMemory
1062440awuArt Collections (BOI22_art)C++17
100 / 100
1192 ms1348 KiB
#include <bits/extc++.h> using namespace std; using namespace __gnu_pbds; // #define int long long #define ll long long #define f first #define s second #define all(x) x.begin(), x.end() #define debug(x) [&](decltype(x) _x) {cerr << #x << " = " << _x << endl; return _x;}(x) using pii = pair<int, int>; // const ll inf = 1ll << 60; const int inf = 1 << 30; template <typename T, typename U> ostream& operator<<(ostream& out, pair<T, U> p) { return out << "(" << p.f << ", " << p.s << ")"; } template <typename T, typename = decltype(begin(declval<T>()))> typename enable_if<!is_same<T, string>::value, ostream&>::type operator<<(ostream& out, T x) { string dlm = ""; out << "{"; for(auto i : x) { out << dlm << i; dlm = ", "; } return out << "}"; } // signed main() { // ios_base::sync_with_stdio(0); // cin.tie(0); // } #include "art.h" int query(vector<int> a) { for(int i = 0; i < a.size(); i++) { a[i]++; } return publish(a); }; void solve(int n) { vector<int> id(n); iota(all(id), 0); int b = query(id); vector<int> ans(n); auto a = id; for(int i = n - 1; i > 0; i--) { vector<int> q{i}; for(int j = 0; j < n; j++) { if(j != i) q.push_back(j); } int x = query(q) - b; int y = (i + x) / 2; ans[a[y]] = i; a.erase(a.begin() + y); } for(int i = 0; i < n; i++) { ans[i]++; } answer(ans); }

Compilation message (stderr)

art.cpp: In function 'int query(std::vector<int>)':
art.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |   for(int i = 0; i < a.size(); i++) {
      |                  ~~^~~~~~~~~~
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...