Submission #713231

#TimeUsernameProblemLanguageResultExecution timeMemory
713231gun_ganArt Collections (BOI22_art)C++17
100 / 100
1566 ms664 KiB
#include "art.h"
using namespace std;

void solve(int n) {
      vector<int> ans(n), v;
      int x = 0;
      {
            for(int j = 2; j <= n; j++) {
                  v.push_back(j);
            }
            v.push_back(1);
            x = publish(v);

            v.clear();
            v.push_back(1);
            for(int j = 2; j <= n; j++) {
                  v.push_back(j);
            }

            int y = publish(v);
            ans[n - (x - y + n - 1) / 2 - 1] = 1;
            x = y;
      }

      int cnt = 2;
      while(cnt < n) {
            int b = v.back();
            for(int i = n - 1; i >= 1; i--) v[i] = v[i - 1];
            v[0] = b;
            int y = publish(v);
            ans[n - (x - y + n - 1) / 2 - 1] = b;
            x = y;
            cnt++;
      }

      for(int i = 0; i < n; i++) {
            if(ans[i] == 0) ans[i] = v.back();
      }

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