Submission #827368

# Submission time Handle Problem Language Result Execution time Memory
827368 2023-08-16T11:53:00 Z vjudge1 Art Collections (BOI22_art) C++17
5 / 100
15 ms 208 KB
#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 = 0; i < N; i++)
    {
        int icpy = i;
        for(int j = 0; j < N; ++j)
        {
            if(j == i)continue;
            swap(ans[i], ans[j]);
            int new_w = publish(ans);
            if(new_w == 0)
            {
                answer(ans);
                //return; // maybe comment out? idk
            }
            if(new_w < w)
            {
                w = new_w;
                i = j;
            }
            else swap(ans[i], ans[j]);
        }
        i = icpy;
    }
    answer(ans);

}


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

Compilation message

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 time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Incorrect 15 ms 208 KB Not correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Incorrect 15 ms 208 KB Not correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Incorrect 15 ms 208 KB Not correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Incorrect 15 ms 208 KB Not correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Incorrect 15 ms 208 KB Not correct
10 Halted 0 ms 0 KB -