Submission #582161

# Submission time Handle Problem Language Result Execution time Memory
582161 2022-06-23T13:06:33 Z YaserFaisal Library (JOI18_library) C++14
0 / 100
316 ms 280 KB
#include "library.h"
#include <bits/stdc++.h>
using namespace std;

void Solve(int n)
{
    if ( n == 1 )
    {
        vector < int > x = {1} ;
        Answer(x) ;
        return ;
    }
	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 ;
            int y = Query(cur) ;
            if ( y > 2 )
            {
                while(true)
                {
                    
                }
            } 
            if ( y == 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 205 ms 276 KB # of queries: 12617
2 Runtime error 316 ms 280 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 205 ms 276 KB # of queries: 12617
2 Runtime error 316 ms 280 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -