Submission #691016

#TimeUsernameProblemLanguageResultExecution timeMemory
691016PagodePaivaArt Collections (BOI22_art)C++17
35 / 100
174 ms424 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(); int t = v.size(); while(l < r){ int mid = (l+r) >> 1; if(mid == t){ l = t; 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 < t;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)

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