Submission #581021

#TimeUsernameProblemLanguageResultExecution timeMemory
581021KoDArt Collections (BOI22_art)C++17
70 / 100
1554 ms728 KiB
#include "art.h"
#include <bits/stdc++.h>

using ll = long long;
using std::vector;
using std::array;
using std::tuple;
using std::pair;

template <class F> struct fixed : private F {
    explicit fixed(F&& f) : F(std::forward<F>(f)) {}
    template <class... Args> decltype(auto) operator()(Args&&... args) const {
        return F::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class T>
constexpr T infty = std::numeric_limits<T>::max() / 2;

void solve(int N) {
    vector<int> ret(N);
    for (int x = 1; x <= N; ++x) {
        vector<int> P(N);
        std::iota(P.begin(), P.end(), 1);
        std::swap(P[0], P[x - 1]);
        const int a = publish(P);
        std::rotate(P.begin(), P.begin() + 1, P.end());
        const int b = publish(P);
        const int h = ((N - 1) - (b - a)) / 2;
        ret[h] = x;
    }
    answer(ret);
}

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