Submission #666989

#TimeUsernameProblemLanguageResultExecution timeMemory
666989berrArt Collections (BOI22_art)C++17
70 / 100
1475 ms576 KiB
#include <bits/stdc++.h> using namespace std; #include "art.h" void solve(int n) { vector<int> ans(n), val1(n), val2(n); vector<int> a(n); for(int i=0; i<n; i++) a[i]=i+1; reverse(a.begin(), a.begin()+n-1); int pos=1; while(val1[a[n-1]-1]==0) { reverse(a.begin(), a.begin()+n-1); int k=publish(a); val1[a[n-1]-1]=k; reverse(a.begin(), a.end()); int p=(n*(n-1))/2-k; val2[a[n-1]-1]=p; } for(int i=0; i<n; i++) { int h=val1[i]+val2[i]-((n-1)*(n-2))/2; h/=2; ans[h]=i+1; } reverse(ans.begin(), ans.end()); answer(ans); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:16:9: warning: unused variable 'pos' [-Wunused-variable]
   16 |     int pos=1;
      |         ^~~
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...