Submission #582156

# Submission time Handle Problem Language Result Execution time Memory
582156 2022-06-23T12:54:25 Z YaserFaisal Library (JOI18_library) C++14
0 / 100
189 ms 284 KB
#include "library.h"
#include <bits/stdc++.h>
using namespace std;

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 i = 1 ; i < n ; i++ )
    {
        int m = ans.size() - 1 ;
        v[ans[m]] = 1 ;
        for ( int j = 0 ; j < n ; j++ )
        {
            if ( v[j] == 1 ) continue;
            cur = v ;
            cur[j] = 1 ;
            if ( Query(cur) == 1 )
            {
                ans.push_back(j) ;
                break ;
            }
        }
    }
    for ( int i = 0 ; i < n ; i++ ) ans[i]++ ;
    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 
# Verdict Execution time Memory Grader output
1 Correct 178 ms 208 KB # of queries: 12617
2 Runtime error 189 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 178 ms 208 KB # of queries: 12617
2 Runtime error 189 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -