Submission #807695

#TimeUsernameProblemLanguageResultExecution timeMemory
807695JuanArt Collections (BOI22_art)C++17
100 / 100
1378 ms696 KiB
#include<bits/stdc++.h> #include "art.h" using namespace std; int ask(int x, int n){ vector<int> v; v.push_back(x); for(int i = 1; i <= n; i++) if(i!=x) v.push_back(i); return publish(v); } void insrt(vector<int> &v, int x, int p){ vector<int> aux; for(int i = 0; i < p; i++) aux.push_back(v[i]); aux.push_back(x); for(int i = p; i < v.size(); i++) aux.push_back(v[i]); swap(v, aux); } void solve(int n){ vector<int> ans; int B = ask(1, n); ans.push_back(1); for(int i = 2; i <= n; i++){ // int x = ask(i); // int antes = (i-1-B+x)/2; // insrt(ans, i, antes); insrt(ans, i, (i-1-B+ask(i,n))/2); } answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void insrt(std::vector<int>&, int, int)':
art.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int i = p; i < v.size(); i++) aux.push_back(v[i]);
      |                 ~~^~~~~~~~~~
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...