Submission #827382

#TimeUsernameProblemLanguageResultExecution timeMemory
827382vjudge1Art Collections (BOI22_art)C++17
20 / 100
93 ms208 KiB
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include"art.h" // Don't forget to uncomment!
using namespace std;
typedef vector<int> vi;

/*
int publish(vector<int> R)
{
    for(int& i : R)cout << i << ' ';cout << endl;// COMMENT OUT
    int w;
    cin >> w;
    return w;
}
*/

/*
void answer(vector<int> R)
{
    for(int& i : R)cout << i << ' ';cout << endl;
}
*/

void solve(int N)
{
    vector<int> ans(N);
    iota(ans.begin(), ans.end(), 1ll);
    int w = publish(ans);
    for(int i = 1; i < N; i++)
    {
        for(int j = i - 1; j >= 0; --j)
        {
            swap(ans[j + 1], ans[j]);
            int new_w = publish(ans);

            if(new_w < w)
            {
                w = new_w;
            }
            else
            {
                swap(ans[j + 1], ans[j]);
            }
        }
        if(w == 0)break;
    }
    answer(ans);

}


/*
int main()
{
    solve(4);
}
*/

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