Submission #982391

#TimeUsernameProblemLanguageResultExecution timeMemory
982391AiperiiiArt Collections (BOI22_art)C++17
50 / 100
579 ms1336 KiB
#include <bits/stdc++.h> #include "art.h" #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; vector <int> ans; void merge(int l, int r){ if(l==r)return; int md=(l+r)/2; merge(l,md); merge(md+1,r); vector <int> ord; int p1=l,p2=md+1; int cur=publish(ans); while(p1<=md && p2<=r){ swap(ans[p1],ans[p2]); int nw=publish(ans); swap(ans[p1],ans[p2]); if(nw>cur){ ord.pb(ans[p1]); p1++; } else{ ord.pb(ans[p2]); p2++; cur=nw; } } for(int i=p1;i<=md;i++)ord.pb(ans[i]); for(int i=p2;i<=r;i++)ord.pb(ans[i]); int pos=0; for(int i=l;i<=r;i++){ ans[i]=ord[pos]; pos++; } } void solve(int N){ for(int i=1;i<=N;i++)ans.pb(i); merge(0,N-1); answer(ans); return; }

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