Submission #574163

#TimeUsernameProblemLanguageResultExecution timeMemory
574163MilosMilutinovicArt Collections (BOI22_art)C++17
100 / 100
1896 ms572 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; int query(vector<int> v) { return publish(v); } void solve(int n) { vector<int> p(n); iota(p.begin(), p.end(), 1); int x = query(p); for (int i = 1; i < n; i++) { vector<int> q(1, i + 1); for (int j = 0; j < i; j++) { q.push_back(p[j]); } for (int j = i + 1; j < n; j++) { q.push_back(j + 1); } int y = query(q); int z = -((y - x - i) / 2); int j = i; while (z--) { swap(p[j], p[j - 1]); x--; j--; } } answer(p); }

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