Submission #871811

#TimeUsernameProblemLanguageResultExecution timeMemory
871811imarnArt Collections (BOI22_art)C++17
100 / 100
1213 ms1560 KiB
#include<bits/stdc++.h> #include "art.h" #define f first #define s second #define ll long long #define pb push_back #define pii pair<int,int> #define pll pair<ll,ll> #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() using namespace std; /*int x[4]={0,1,3,2}; int publish(vector<int>a){ int cnt=0; for(int i=0;i<a.size();i++){ for(int j=0;j<i;j++){ if(x[a[i]]<x[a[j]])cnt++; } }return cnt; }*/ void solve(int N) { vector<int>a(N); int ans[N+1]; for(int i=0;i<N;i++)a[i]=i+1; int tt1=publish(a);int st=tt1; for(int i=1;i<=N-1;i++){ for(int j=i;j<N;j++)a[j]=j-i+1; for(int j=0;j<i;j++)a[j]=N-i+j+1; int tt2=publish(a); ans[N-i+1]=(N-1+tt2-tt1)/2; tt1=tt2; }ans[1]=(N-1+st-tt1)/2; vector<int>ord(N); for(int i=1;i<=N;i++)ord[ans[i]]=i; answer(ord); //for(int i=0;i<N;i++)cout<<ord[i]<<" "; }

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