제출 #716905

#제출 시각아이디문제언어결과실행 시간메모리
716905adrilenArt Collections (BOI22_art)C++17
100 / 100
1528 ms724 KiB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> pii;

#include "art.h"


void solve(int n) {
    
    vector <int> v(n);
    for (int i = 0; i < n; i++) v[i] = i + 1;

    int last, first;
    first = last = publish(v);

    vector <int> output(n);

    int val, diff;
    for (int i = 0; i < n - 1; i++)
    {
        v.insert(v.begin(), v.back());
        v.pop_back();
    
        val = publish(v);

        diff = val - last;

        output[(diff + n - 1) / 2] = v.front();
        swap(last, val);
    }


    val = first;
    diff = val - last;
    output[(diff + n - 1) / 2] = v.back();

    answer(output);
}


/*

x + 1

3 1 2 5 4

x + 3

4 3 1 2 5


1   2   3  4   5
-4  -2  0  2   4



1 2 3 4 

-3 -1 1 3

*/

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...