Submission #574229

#TimeUsernameProblemLanguageResultExecution timeMemory
574229stevancvArt Collections (BOI22_art)C++17
100 / 100
1529 ms696 KiB
#include <bits/stdc++.h> #include "art.h" #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 2e5 + 2; void solve(int n) { vector<int> ans(n); iota(ans.begin(), ans.end(), 1); int prv = publish(ans); for (int i = 1; i < n; i++) { vector<int> v; v.push_back(i + 1); for (int j = 0; j < n; j++) { if (ans[j] != i + 1) v.push_back(ans[j]); } int y = publish(v); int o = (prv + y - i) / 2; int gde = y - o; for (int j = i; j > gde; j--) { swap(ans[j], ans[j - 1]); } prv = o; } 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...