Submission #849865

#TimeUsernameProblemLanguageResultExecution timeMemory
849865MinaRagy06Art Collections (BOI22_art)C++17
20 / 100
83 ms440 KiB
#include <bits/stdc++.h> #include "art.h" #ifdef MINA #include "sample_grader.cpp" #endif using namespace std; void solve(int n) { vector<int> a(n); for (int i = 0; i < n; i++) { a[i] = i + 1; } int done[n + 1]{}; int prv = publish(a); for (int i = n - 1; i >= 0; i--) { if (done[a[i]]) continue; while (i + 1 < n) { vector<int> lst = a; swap(a[i], a[i + 1]); i++; int cur = publish(a); if (cur > prv) { a = lst; i--; break; } else { prv = cur; } } done[a[i]] = 1; } answer(a); }

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