답안 #715922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
715922 2023-03-28T12:40:41 Z ismayil Art Collections (BOI22_art) C++17
0 / 100
1 ms 208 KB
#include "art.h"
#include<bits/stdc++.h>
using namespace std;
//     g++ -std=c++17 art_sample.cpp sample_grader.cpp
int n;
int f(){
    vector<int> order;
    for (int i = 1; i <= n; i++)
    {
        order.push_back(i);
    }
    return publish(order);
}
int f_inv(int a){
    vector<int> order;
    
    for (int i = 1; i <= n; i++)
    {
        if(i == a) continue;
        order.push_back(i);
    }
    order.push_back(a);
    return publish(order);
}
int cell[4001];
void solve(int N) {
    n = N;
    vector<int> ans(n, 0);
    int inv = f();
    for (int i = 1; i <= n; i++)
    {
        int ninv = f_inv(i);
        /*
            inv = x + y + pos(i);
            ninv = n - i - pos(i) + x + y;
            inv - ninv = pos(i) - n + i + pos(i)
            2 * pos(i) = inv - ninv + n - i
        */
        int pos = (inv - ninv + n - i) / 2;
        //cout << i << " " << pos << endl;
        for(int j = 0; j < 5; j++){
            if(cell[j] == 0 && pos == 0){
                ans[j] = i;
                cell[j] = 1;
                break;
            }
            if(cell[j] == 0) pos--;
        }
    }
    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) {
      |        ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 1 ms 208 KB Not correct
3 Halted 0 ms 0 KB -