Submission #1120658

#TimeUsernameProblemLanguageResultExecution timeMemory
1120658vjudge1Art Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#include "art.h" using namespace std; int u[4001]; int p[4001]; int pp[4001]; int nn; //int a[4001]; // int publish(vector<int>r){ // int j=0; // for(int i=0;i<nn;i++){ // //cout<<r[i]<<" "; // if(p[r[i]]<i){ // j+=i-p[r[i]]; // } // } // //cout<<" "<<j; // //cout<<"\n"; // return j; // } // void answer(vector<int>r){ // for(int i=0;i<nn;i++){ // cout<<r[i]<<" "; // } // cout<<"\n"; // } vector<int> get(vector<int>v,int uu,int d,int p){ vector<int>ans; //cout<<uu<<" "<<d<<" "<<p<<"\n"; for(int i=0;i<nn;i++){ if(i==uu){ continue; } if(i==p){ ans.push_back(d); } ans.push_back(v[i]); } return ans; } void solve (int n){ nn=n; vector<int>v; for(int i=1;i<=n;i++){ v.push_back(i); } int k=publish(v); if(k==0){ answer(v); return; } while(publish(v)!=0){ for(int i=0;i<=n;i++){ u[i]=0; } for(int i=n-1;i>=0;i--){ //cout<<"\n\n"; if(u[i]==0){ //cout<<v[i]<<"\n\n"; k=publish(v); if(k==0){ answer(v); return; } int x; int j=i; for(int l=j-1;l>=0;l--){ if(u[l]==0){ vector<int>s=get(v,j,v[j],l); x=publish(s); if(x==0){ answer(s); return; } if(x<k){ k=x; j=l; v=s; } } } //cout<<j<<"\n\n"; u[j]=1; i++; } } } // for(int i=0;i<n;i++){ // cout<<u[i]<<" "; // } // cout<<"\n"; answer(v); } // int main(){ // cin>>nn; // for(int i=0;i<nn;i++){ // cin>>a[i]; // p[a[i]]=i; // } // solve(nn); // }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:52:11: error: 'publish' was not declared in this scope
   52 |     int k=publish(v);
      |           ^~~~~~~
art.cpp:54:9: error: 'answer' was not declared in this scope
   54 |         answer(v);
      |         ^~~~~~
art.cpp:67:21: error: 'answer' was not declared in this scope
   67 |                     answer(v);
      |                     ^~~~~~
art.cpp:77:29: error: 'answer' was not declared in this scope
   77 |                             answer(s);
      |                             ^~~~~~
art.cpp:97:5: error: 'answer' was not declared in this scope
   97 |     answer(v);
      |     ^~~~~~
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) {
      |        ~~~~~~~~~^~~~