Submission #735168

# Submission time Handle Problem Language Result Execution time Memory
735168 2023-05-03T16:28:55 Z DAleksa Art Collections (BOI22_art) C++17
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>
#include "art.h"

using namespace std;

void solve(int n) {
    vector<int> inv(n);
    vector<int> ask(n);
    iota(ask.begin(), ask.end(), 1);
    inv[0] = publish(ask);
    for(int i = 1; i < n; i++) {
        ask[n - 1] = i;
        for(int j = 0; j < n - 1; j++) ask[j] = (j + 1 < i ? j + 1 : j + 2);
        inv[i] = publish(ask);
    }
    for(int i = 0; i < n; i++) cout << inv[i] << " ";
    cout << "\n";
    for(int i = 1; i < n; i++) inv[i] = (inv[0] - inv[i] + n - i) / 2;
    vector<int> res(n);
    vector<bool> mark(n + 1, false);
    for(int i = 1; i < n; i++) {
        int cnt = 0;
        for(int j = 1; j <= n; j++) {
            if(mark[j]) continue;
            cnt++;
            if(cnt == inv[i] + 1) {
                res[i - 1] = i;
                mark[i] = true;
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        if(!mark[i]) {
            res[n - 1] = i;
            break;
        }
    }
    answer(res);
}
// inv[0] - inv[1] = < - >
// < + > = n - 1
// inv[0] - inv[1] + n - 1 = 2 * <
//

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 208 KB Security violation!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Security violation!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Security violation!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Security violation!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Security violation!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Security violation!
2 Halted 0 ms 0 KB -