Submission #582151

# Submission time Handle Problem Language Result Execution time Memory
582151 2022-06-23T12:41:22 Z YaserFaisal Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
void Solve(int n)
{
    
	vector < int > ans , v(n,0) , cur ;
    
    for ( int i = 0 ; i < n ; i++ )
    {
        int sum = 0 ; 
        for ( int j = 0 ; j < n ; j++ )
        {
            if ( i == j ) continue;
            cur = v ;
            cur[i] = cur[j] = 1 ;
            if ( Query(cur) == 1 ) sum++ ;
        }
        if ( sum == 1 ) { ans.push_back(i) ; break ; }
    }
    
    for ( int j = 1 ; j < n ; j++ )
    {
        v[ans[ans.size()-1]] = 1 ;
        for ( int i = 0 ; i < n ; i++ )
        {
            if ( v[i] == 1 ) continue;
            cur = v ;
            cur[i] = 1 ;
            if ( Query(cur) == 1 )
            {
                ans.push_back(i) ;
                break ;
            }
        }
    }
    for ( int i = 0 ; i < n ; i++ ) ans[i]++ ;
    Answer(ans) ;
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:4:2: error: 'vector' was not declared in this scope
    4 |  vector < int > ans , v(n,0) , cur ;
      |  ^~~~~~
library.cpp:4:11: error: expected primary-expression before 'int'
    4 |  vector < int > ans , v(n,0) , cur ;
      |           ^~~
library.cpp:12:13: error: 'cur' was not declared in this scope
   12 |             cur = v ;
      |             ^~~
library.cpp:12:19: error: 'v' was not declared in this scope
   12 |             cur = v ;
      |                   ^
library.cpp:14:18: error: 'Query' was not declared in this scope
   14 |             if ( Query(cur) == 1 ) sum++ ;
      |                  ^~~~~
library.cpp:16:27: error: 'ans' was not declared in this scope
   16 |         if ( sum == 1 ) { ans.push_back(i) ; break ; }
      |                           ^~~
library.cpp:21:9: error: 'v' was not declared in this scope
   21 |         v[ans[ans.size()-1]] = 1 ;
      |         ^
library.cpp:21:11: error: 'ans' was not declared in this scope
   21 |         v[ans[ans.size()-1]] = 1 ;
      |           ^~~
library.cpp:25:13: error: 'cur' was not declared in this scope
   25 |             cur = v ;
      |             ^~~
library.cpp:27:18: error: 'Query' was not declared in this scope
   27 |             if ( Query(cur) == 1 )
      |                  ^~~~~
library.cpp:34:37: error: 'ans' was not declared in this scope
   34 |     for ( int i = 0 ; i < n ; i++ ) ans[i]++ ;
      |                                     ^~~
library.cpp:35:12: error: 'ans' was not declared in this scope
   35 |     Answer(ans) ;
      |            ^~~
library.cpp:35:5: error: 'Answer' was not declared in this scope
   35 |     Answer(ans) ;
      |     ^~~~~~