Submission #977710

#TimeUsernameProblemLanguageResultExecution timeMemory
977710KK_1729Art Collections (BOI22_art)C++17
100 / 100
1411 ms1772 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; // #define int long long #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define pb push_back #define all(a) a.begin(), a.end() #define endl "\n" // // --- Sample implementation for the task art --- // // To compile this program with the sample grader, place: // art.h art_sample.cpp sample_grader.cpp // in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory, // left click on "Open in terminal") and enter e.g.: // g++ -std=c++17 art_sample.cpp sample_grader.cpp // in this folder. This will create a file a.out in the current directory which you can execute from the terminal // as ./a.out // See task statement or sample_grader.cpp for the input specification // void solve(int N) { int n = N; vector<int> order = {}; FOR(i,1,n+1) order.pb(i); vector<int> ans(n, -1); int prev = publish(order); FOR(i,0,n-1){ vector<int> new_order; new_order.pb(order[n-1]); FOR(i,0,n-1) new_order.pb(order[i]); order = new_order; int q = publish(order); int c = order[0]; ans[((n-1)+(q-prev))/2] = c; prev = q; } vector<int> done(n+1); FOR(i,0,n) done[ans[i]] = 1; int pos = -1; FOR(i,0,n){ if (ans[i] == -1) pos = i; } int val = 0; FOR(i,1,n+1){ if (!done[i]) val = i; } ans[pos] = val; 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...