Submission #579607

# Submission time Handle Problem Language Result Execution time Memory
579607 2022-06-19T13:25:31 Z Elias Art Collections (BOI22_art) C++17
0 / 100
1 ms 284 KB
#include <bits/stdc++.h>

#ifndef _DEBUG
#include <art.h>

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#endif

using namespace std;

#define lint int64_t

#ifdef _DEBUG

int publish(vector<int> R)
{
    for (int i : R)
        cout << i << " ";
    cout << "\n";

    int x;
    cin >> x;

    return x;
}

void answer(vector<int> R)
{
    cout << "Answer: ";
    for (int i : R)
        cout << i << " ";
    cout << "\n";
}

#endif

void solve(int N)
{
    int n = N;

    vector<int> empty(n);
    for (int i = 0; i < n; i++)
        empty[i] = i + 1;

    int last = publish(empty);

    for (int i = 1; i < n; i++)
    {

        vector<int> current = empty;
        int v = current[i];
        current.erase(current.begin() + i);
        current.insert(current.begin(), v);

        int curr = publish(current);

        int diff = last - curr;

        int pos = (n + diff - 1) / 2;

        empty.erase(empty.begin() + i);
        empty.insert(empty.begin() + pos, v);

        last = publish(empty);
    }

    answer(empty);
}

#ifdef _DEBUG

int main()
{
    int n;
    cin >> n;

    solve(n);
}

#endif

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 Incorrect 1 ms 284 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Not correct
2 Halted 0 ms 0 KB -