Submission #731388

#TimeUsernameProblemLanguageResultExecution timeMemory
731388nguyentunglamArt Collections (BOI22_art)C++17
100 / 100
1713 ms680 KiB
#include "art.h" #include<bits/stdc++.h> using namespace std; const int N = 4010; bool taken[N]; int query[N], cnt[N]; void solve(int n) { vector<int> ask, ret; for(int i = 1; i <= n; i++) ask.push_back(i); int init = publish(ask); for(int i = 2; i <= n; i++) { ask = {i}; for(int j = 1; j <= n; j++) if (j != i) ask.push_back(j); query[i] = publish(ask); cnt[i] = i - 1; } for(int loop = 1; loop <= n; loop++) { int idx = 1; for(int i = 2; i <= n; i++) if (!taken[i] && init - cnt[i] == query[i]) idx = i; ret.push_back(idx); taken[idx] = 1; for(int i = idx + 1; i <= n; i++) cnt[i]--, query[i]--; } answer(ret); }

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