Submission #714341

# Submission time Handle Problem Language Result Execution time Memory
714341 2023-03-24T09:19:30 Z vjudge1 Art Collections (BOI22_art) C++17
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>
#include "art.h"


#define ll long long
#define pii pair<int, int>

using namespace std;


void solve(int N){
    int n = N;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        v[i] = i + 1;
    }
    int a = publish(v);
    vector<int> ans(n);
    for (int i = 1; i < n; i++)
    {
        v.erase(v.begin() + (i - 1));
        v.insert(v.begin(), i);
        int p1 = publish(v);
        
        v.erase(v.begin());
        v.push_back(i);
        int p2 = publish(v);

        v.pop_back();
        v.insert(v.begin() + (i - 1), i);
        int pos = n - (n - 1 + abs(a - p1) + abs(a - p2)) / 2;
        ans[pos - 1] = i;
    }
    for (int i = 0; i < n; i++)
    {
        if(ans[i] == 0){
            ans[i] = n;
            break;
        }
    }

    answer(ans);
}

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