Submission #1007452

#TimeUsernameProblemLanguageResultExecution timeMemory
1007452andecaandeciArt Collections (BOI22_art)C++17
100 / 100
818 ms1680 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() // int publish(vector<int> B) { // answer(B); // int ans;cin>>ans; // return ans; // } // void answer(vector<int> B) { // for (auto el : B) cout << el << " "; // cout << endl; // } // A = [5, 2, 3, 1, 4], inv = 4 + 1 + 1 = 6 // A = [2, 3, 1, 4, 5], inv = 1 + 1 = 2 // A = [3, 1, 4, 5, 2], inv = 2 + 1 + 1 = 4 // A = [1, 4, 5, 2, 3], inv = 2+2 = 4 // A = [4, 5, 2, 3, 1], inv = 3+3+2 = 8 void solve(int n) { vector<int> a(n); iota(all(a),1); vector<int> rec(n); vector<int> ans; for (int i = 0; i < n; i++) { int x = publish(a); a.push_back(*a.begin()); a.erase(a.begin()); ans.push_back(x); } vector<pair<int, int>> delt(n); for (int i = 0; i < n; i++) { delt[i] = {ans[(i+1)%n] - ans[i], i}; } sort(all(delt)); reverse(all(delt)); for (int i = 0; i < n; i++) rec[i] = delt[i].second+1; answer(rec); } // int main() { // 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...