Submission #579666

#TimeUsernameProblemLanguageResultExecution timeMemory
579666jasminArt Collections (BOI22_art)C++17
100 / 100
1644 ms704 KiB
#include<bits/stdc++.h> #include<art.h> using namespace std; /*int publish(vector<int>& p){ for(auto e: p){ cout << e << " "; } cout << "\n" << flush; int ans; cin >> ans; return ans; } void answer(vector<int> p){ cout << "answer: "; for(auto e: p){ cout << e << " "; } cout << "\n"; }*/ void solve(int n){ vector<int> p(n); iota(p.begin(), p.end(), 1); vector<pair<int,int> > ans(n); int a, b; a=publish(p); int first=a; for(int i=1; i<=n-1; i++){ int last=p[0]; for(int j=0; j<n-1; j++){ p[j]=p[j+1]; } p[n-1]=last; b=publish(p); ans[i-1]={b-a, i}; a=b; } ans[n-1]={first-a, n}; sort(ans.begin(), ans.end()); reverse(ans.begin(), ans.end()); for(int i=0; i<n; i++){ p[i]=ans[i].second; } answer(p); } /*signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; solve(n); }*/

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