답안 #582032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
582032 2022-06-23T09:48:31 Z YaserFaisal 도서관 (JOI18_library) C++14
컴파일 오류
0 ms 0 KB
//#include "library.h"
#include <bits/stdc++.h>
using namespace std;

void Solve(int n)
{
	vector < int > ans , v(n,0) , cur(n,0) ;
    ans.push_back(0) ;
    int aim = 0 ; 
    for ( int i = 0 ; i < n ; i++ )
    {
        int sum = 0 ; 
        for ( int j = 0 ; j < n ; j++ )
        {
            cur = v ;
            cur[i] = cur[j] = 1 ;
            if ( Query(cur) == 1 ) sum++ ;
        }
        if ( sum == 1 ) { aim = i+1 ; break ; }
    }
    ans.push_back(aim) ;
    for ( int j = 1 ; j < n ; j++ )
    {
        v[ans[ans.size()-1]-1] = 1 ;
        for ( int i = 0 ; i < n ; i++ )
        {
            cur = v ;
            cur[i] = 1 ;
            if ( Query(cur) == 1 )
            {
                ans.push_back(i+1) ;
                break ;
            }
        }
    }
    Answer(ans) ;
}
// Query(x) , x : where x is a vector with 0 or 1 
// Answer(x) . x : where x is a vector with number from 1 -> n 

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:17:18: error: 'Query' was not declared in this scope
   17 |             if ( Query(cur) == 1 ) sum++ ;
      |                  ^~~~~
library.cpp:29:18: error: 'Query' was not declared in this scope
   29 |             if ( Query(cur) == 1 )
      |                  ^~~~~
library.cpp:36:5: error: 'Answer' was not declared in this scope
   36 |     Answer(ans) ;
      |     ^~~~~~