Submission #691012

#TimeUsernameProblemLanguageResultExecution timeMemory
691012PagodePaivaArt Collections (BOI22_art)C++17
35 / 100
189 ms428 KiB
#include<bits/stdc++.h> #include "art.h" #define pb push_back #define all(v) v.begin(), v.end() using namespace std; int n; vector <int> busca(vector <int> v, int k){ int l = 0, r = v.size(); while(l < r){ int mid = (l+r) >> 1; if(mid == v.size()){ l = v.size(); break; } vector <int> aux; aux.pb(k); aux.pb(v[mid]); for(int i = 1;i <= n;i++){ if(i == k or i == v[mid]) continue; aux.pb(i); } int x = publish(aux); aux[0] = v[mid]; aux[1] = k; int y = publish(aux); if(x > y){ // v[mid] > k r = mid; } else{ l = mid+1; } } vector <int> res; for(int i = 0;i < l;i++){ res.pb(v[i]); } res.pb(k); for(int i = l;i < v.size();i++){ res.pb(v[i]); } return res; } void solve(int N){ n = N; vector <int> v; v.pb(1); for(int i = 2;i <= n;i++){ v = busca(v, i); } reverse(all(v)); answer(v); return; }

Compilation message (stderr)

art.cpp: In function 'std::vector<int> busca(std::vector<int>, int)':
art.cpp:15:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   if(mid == v.size()){
      |      ~~~~^~~~~~~~~~~
art.cpp:53:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  for(int i = l;i < v.size();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...