Submission #623843

#TimeUsernameProblemLanguageResultExecution timeMemory
623843IwanttobreakfreeArt Collections (BOI22_art)C++17
0 / 100
0 ms208 KiB
#include "art.h" #include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; /*vector<int> t={2,1,4,3}; vector<set<int>> s; /*int publish(vector<int>& a){ int ans=0; for(int i=0;i<a.size();i++){ for(int j=0;j<i;j++){ if(s[a[i]-1].find(a[j])==s[a[i]-1].end())ans++; } } return ans; }*/ int query(vector<int>& order,int a,int b){ vector<int> q; for(int i=a;i<b;i++)q.push_back(order[i]); return publish(q); } void solve(int N) { vector<int> order; for(int i=0;i<N;i++)order.push_back(i+1); for(int i=0;i<N;i++)order.push_back(i+1); vector<int> ans(N); vector<pair<int,int>> dif(N); for(int i=0;i<N;i++){ ans[i]=query(order,i,N+i); } for(int i=0;i<N;i++){ dif[i].second=i+1; dif[i].first=ans[i]-ans[(i+1)%N]; } sort(dif.begin(),dif.end()); vector<int> sol(N); for(int i=0;i<N;i++)sol[i]=dif[i].second; for(int i=0;i<N;i++)cout<<sol[i]<<' '; answer(sol); } /*int main(){ s=vector<set<int>> (4,set<int>()); for(int i=0;i<4;i++){ for(int j=0;j<i;j++){ s[t[i]-1].insert(t[j]); } } solve(4); }*/

Compilation message (stderr)

art.cpp:9:1: warning: "/*" within comment [-Wcomment]
    9 | /*int publish(vector<int>& a){
      |  
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...