Submission #714445

#TimeUsernameProblemLanguageResultExecution timeMemory
714445vjudge1Art Collections (BOI22_art)C++17
50 / 100
815 ms420 KiB
#include "art.h" #include "bits/stdc++.h" #define intt long long #define pb push_back #define endl '\n' #define F first #define S second #define pii pair<int,int> #define pll pair<intt,intt> #define ld long double #define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; const int sz = 2e5+5; vector<int>v; int inv; bool cmp(int i, int j) { swap(v[i-1], v[j-1]); int inv1 = publish(v); swap(v[i-1], v[j-1]); return inv > inv1; } void solve(int N) { for ( int i = 1; i <= N; i++ ){ v.pb(i); } inv = publish(v); vector<int>res = v; stable_sort(res.begin(),res.end(), cmp); answer(res); }

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