Submission #796727

#TimeUsernameProblemLanguageResultExecution timeMemory
796727TheSahibArt Collections (BOI22_art)C++17
50 / 100
759 ms31984 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; vector<int> v; int x = 0; map<vector<int>, int> mp; int ask(vector<int>& v){ if(mp.find(v) != mp.end()) return mp[v]; return mp[v] = publish(v); } bool comp(int a, int b){ swap(v[a - 1], v[b - 1]); int y = ask(v); swap(v[a - 1], v[b - 1]); if(a < b){ return x < y; } else{ return x > y; } } void solve(int N) { v.resize(N); iota(v.begin(), v.end(), 1); x = ask(v); vector<int> ans(N); iota(ans.begin(), ans.end(), 1); stable_sort(ans.begin(), ans.end(), comp); 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...