Submission #721571

#TimeUsernameProblemLanguageResultExecution timeMemory
721571Erkinoff_MohammedArt Collections (BOI22_art)C++17
100 / 100
1681 ms920 KiB
#include "bits/stdc++.h" #include "art.h" using namespace std; #define INF 2000000000 #define INFLL 3000000000000000000LL #define ll long long void solve(int N){ vector<int>R(N); set<int>free_pos; for(int i=1;i<=N;i++){ R[i-1]=i; free_pos.insert(i-1); } vector<int>out(N); int prev=publish(R); for(int i=1;i<N;i++){ R.erase(R.begin()); R.push_back(i); int cur=publish(R); int qw=(cur+prev-N+1)/2; out[prev-qw]=i; free_pos.erase(prev-qw); prev=cur; } out[*(free_pos.begin())]=N; answer(out); }

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