Submission #721594

#TimeUsernameProblemLanguageResultExecution timeMemory
721594Mr_HusanboyArt Collections (BOI22_art)C++17
35 / 100
240 ms976 KiB
#include "art.h"
#include<bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
template<typename T>
int len(T &a){
    return a.size();
}

using namespace std;

void solve(int n) {
    vector comp(n, vector(n, -1));
    vector<int> v(n);
    iota(all(v), 1);

    stable_sort(all(v), [&](int i, int j){
        if(~comp[i - 1][j - 1]) return comp[i - 1][j - 1];
        vector<int> p = {i,j};
        for(int k = 1; k <= n; k ++){
            if(k != i && k != j) p.push_back(k);
        }
        int y = publish(p);
        swap(p[0], p[1]);
        int x = publish(p);
        if(y < x){
            comp[i - 1][j - 1] = 1;
            comp[j - 1][i - 1] = 0;
        }else
            comp[j - 1][i - 1] = 1,
            comp[i - 1][j - 1] = 0;
        return comp[i - 1][j - 1];
    });
    answer(v);
}

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