제출 #1120864

#제출 시각아이디문제언어결과실행 시간메모리
1120864vjudge1Art Collections (BOI22_art)C++17
0 / 100
3 ms848 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"; // } deque<int> merge(deque<int>v,deque<int>v1){ for(auto it : v1){ v.push_back(it); } return v; } vector<int>vv(deque <int>v){ vector<int>b; for(auto it : v){ b.push_back(it); } return b; } void solve (int n){ nn=n; deque<int>v; for(int i=1;i<=n;i++){ v.push_back(i); } deque<int>v1,ans; int k=publish(vv(v)); if(k==0){ answer(vv(v)); return; } while(publish(vv(merge(v,v1)))!=0){ k=publish(vv(merge(v,v1))); ans=v; for(int i=0;i<nn;i++){ v.push_back(v[0]); v.pop_front(); int x=publish(vv(merge(v,v1))); if(x<k){ k=x; ans=v; } } v=ans; v1.push_front(v[(int)v.size()-1]); v.pop_back(); } // for(int i=0;i<n;i++){ // cout<<u[i]<<" "; // } // cout<<"\n"; answer(vv(merge(v,v1))); } // int main(){ // cin>>nn; // for(int i=0;i<nn;i++){ // cin>>a[i]; // p[a[i]]=i; // } // solve(nn); // }

컴파일 시 표준 에러 (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...