Submission #579685

#TimeUsernameProblemLanguageResultExecution timeMemory
579685JosiaArt Collections (BOI22_art)C++17
70 / 100
1600 ms712 KiB
#include <bits/stdc++.h> #include "art.h" using namespace std; int query(vector<int> a) { for (int &i: a) i++; return publish(a); } void solve(int n) { vector<int> a; for (int i = 0; i<n; i++) { a.push_back(i); } vector<int> res(n*2, -1); res[n-1] = 0; int lastpos = n-1; for (int i = 1; i<n; i++) { swap(a[i-1], a[0]); swap(a[i], a[n-1]); int one = query(a); swap(a[n-1], a[0]); int two = query(a); swap(a[n-1], a[0]); swap(a[i], a[n-1]); swap(a[i-1], a[0]); res[lastpos+(abs(one-two)/2 +1) * ((one-two)/abs(one-two))] = i; lastpos = lastpos+(abs(one-two)/2 +1) * ((one-two)/abs(one-two)); } reverse(res.begin(), res.end()); vector<int> ret; for (int i: res) { if (i != -1) { ret.push_back(i+1); } } answer(ret); }

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