Submission #720841

#TimeUsernameProblemLanguageResultExecution timeMemory
720841NeroZeinArt Collections (BOI22_art)C++17
100 / 100
1521 ms756 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { int n = N; vector<int> ans(n); deque<int> v(n); for (int i = 1; i <= n; ++i) { v[i - 1] = i; } vector<int> vv(n); for (int i = 0; i < n; ++i) { vv[i] = v[i]; } int la = publish(vv); for (int i = 1; i < n; ++i) { v.push_back(i); v.pop_front(); for (int j = 0; j < n; ++j) { vv[j] = v[j]; } int New = publish(vv); int x = (n - 1 + New - la) / 2; int y = n - 1 - x; ans[y] = i; la = New; } for (int i = 0; i < n; ++i) { if (!ans[i]) { ans[i] = n; break; } } 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...