Submission #964590

#TimeUsernameProblemLanguageResultExecution timeMemory
964590aegArt Collections (BOI22_art)C++17
100 / 100
1265 ms1864 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int n){ vector<int> def(n); iota(def.begin() , def.end() , 1); int curval = publish(def); for(int i = 2; i<=n;i++){ vector<int> cur = def; cur.erase(find(cur.begin() , cur.end() , i)); cur.insert(cur.begin() , i); int tmpval = curval; int curr = publish(cur); int diff = curr - tmpval; int ind = (i - 1 - diff) / 2 + diff; curval = curr - ind; def.erase(find(def.begin() , def.end() , i)); def.insert(def.begin() + ind , i); } answer(def); }

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