Submission #914404

#TimeUsernameProblemLanguageResultExecution timeMemory
914404hngwlogArt Collections (BOI22_art)C++17
100 / 100
1184 ms1696 KiB
#include <bits/stdc++.h> #include "art.h" using namespace std; int n, cur = - 1; void process(int cnt, vector<int> &a, vector<int> &ans) { vector<int> b; for (int i = 0; i < n - cnt - 1; i++) b.push_back(a[i]); for (int i = n - cnt; i < n; i++) b.push_back(a[i]); b.push_back(a[n - cnt - 1]); int nex = publish(b); int num = (nex - cur + cnt) / 2; vector<int> nAns; for (int i = 0; i < cnt - num; i++) nAns.push_back(ans[i]); nAns.push_back(a[n - cnt - 1]); for (int i = cnt - num; i < cnt; i++) nAns.push_back(ans[i]); ans.swap(nAns); a.swap(b); cur = nex; } void solve(int N) { n = N; vector<int> a; for (int i = 1; i <= n; i++) a.push_back(i); cur = publish(a); vector<int> ans; ans.push_back(n); for (int i = 1; i < n; i++) process(i, a, ans); 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...