Submission #849875

#TimeUsernameProblemLanguageResultExecution timeMemory
849875MinaRagy06Art Collections (BOI22_art)C++17
100 / 100
1155 ms1708 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 s = publish(a); int diff[n]{}; for (int i = 1; i < n; i++) { vector<int> b = a; for (int j = i; j - 1 >= 0; j--) { swap(b[j], b[j - 1]); } int news = publish(b); diff[i] = news - s; } for (int i = 1; i < n; i++) { int before = (diff[i] + i) / 2; for (int j = i; j - 1 >= before; j--) { swap(a[j], a[j - 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...