답안 #597434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597434 2022-07-16T02:51:50 Z Hanksburger 도서관 (JOI18_library) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
vector<int> v, zero, tmp, ans;
void Solve(int n)
{
    for (int i=1; i<=n; i++)
    {
        v.push_back(i);
        zero.push_back(0);
    }
    for (int i=0; i<n; i++)
    {
        int l=0, r=n-i-1;
        while (l<r)
        {
            int m=(l+r)/2, res1, res2;
            tmp=zero;
            for (int j=l; j<=m; j++)
                tmp[v[j]-1]=1;
            res1=Query(tmp);
            if (i)
                tmp[ans[i-1]-1]=1;
            else
                for (int j=0; j<n; j++)
                    tmp[j]^=1;
            res2=Query(tmp);
            if (res1>=res2)
                r=m;
            else
                l=m+1;
        }
        ans.push_back(v[l]);
        v.erase(v.begin()+l);
    }
    Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:20:18: error: 'Query' was not declared in this scope
   20 |             res1=Query(tmp);
      |                  ^~~~~
library.cpp:35:5: error: 'Answer' was not declared in this scope
   35 |     Answer(ans);
      |     ^~~~~~