Submission #721584

#TimeUsernameProblemLanguageResultExecution timeMemory
721584sunnatArt Collections (BOI22_art)C++17
50 / 100
742 ms432 KiB
#include "art.h" #include <iostream> using namespace std; int start_inv, x; vector<int> order; void merge_sort(int l, int r){ if(l >= r-1) return; int m = (l + r) / 2; merge_sort(l, m); merge_sort(m, r); int n = r - l; vector<int>b(n); start_inv = publish(order); for(int i = 0, u = l, v = m; i < n; i ++){ if(u == m) b[i] = order[v ++]; else if(v == r) b[i] = order[u ++]; else{ swap(order[u], order[v]); x = publish(order); swap(order[u], order[v]); if(x < start_inv) b[i] = order[v ++]; else b[i] = order[u ++]; } } for(int i = 0; i < n; i ++) order[i+l] = b[i]; } void solve(int N) { for(int i = 1; i <= N; i ++) order.push_back(i); merge_sort(0, N); answer(order); }

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