Submission #949776

#TimeUsernameProblemLanguageResultExecution timeMemory
949776Dec0DeddArt Collections (BOI22_art)C++17
100 / 100
1240 ms64284 KiB
#include <bits/stdc++.h> #include "art.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; void solve(int n) { vector<int> v[n+1]={}; for (int i=1; i<=n; ++i) v[1].push_back(i); int vl[n+1]={}; vl[1]=publish(v[1]); for (int i=2; i<=n; ++i) { v[i]=v[i-1]; v[i].erase(v[i].begin()); v[i].push_back(i-1); vl[i]=publish(v[i]); } vector<int> ans(n, 0); for (int i=1; i+1<=n; ++i) { int s1=vl[i], s2=vl[i+1]; int k=s1-s2+n+1; assert(k%2 == 0); ans[k/2-1]=i; } for (int i=0; i<n; ++i) { if (ans[i] == 0) ans[i]=n; } answer(ans); }

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