Submission #963565

#TimeUsernameProblemLanguageResultExecution timeMemory
963565NotLinuxArt Collections (BOI22_art)C++17
100 / 100
1236 ms1628 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int n){ vector < int > perm(n); iota(perm.begin() , perm.end() , 1); int newres1 = publish(perm); for(int i = 2;i<=n;i++){ vector < int > nperm = perm; nperm.erase(find(nperm.begin() , nperm.end() , i)); nperm.insert(nperm.begin() , i); // cout << "perm : ";for(auto itr : perm)cout << itr << " ";cout << endl; // cout << "nperm : ";for(auto itr : nperm)cout << itr << " ";cout << endl; // cout << endl; int res1 = newres1; int res2 = publish(nperm); int diff = res2 - res1; int indx = (i - 1 - diff) / 2 + diff; newres1 = res2 - indx; // cout << "res1 : " << res1 << " , res2 : " << res2 << " , diff : " << diff << " , indx : " << indx << endl; // cout << endl; perm.erase(find(perm.begin() , perm.end() , i)); perm.insert(perm.begin() + indx , i); } answer(perm); }

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