답안 #804295

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
804295 2023-08-03T07:51:58 Z vjudge1 도서관 (JOI18_library) C++14
19 / 100
136 ms 464 KB
#include<bits/stdc++.h>
#include "library.h"
using namespace std ;
const int N = 1000 ;
bool us[N + 1] ;
bool abu[N + 1][N + 1] ;
//int Query(vector<int>& v)
//{
//    int num ;
//    cout << "? " ;
//    for(int i : v)
//        cout << i << ' ' ;
//    cout << '\n' ;
//    cin >> num ;
//    return num ;
//}
//void Answer(vector<int>&res)
//{
//    cout << "! " ;
//    for(int i : res)
//        cout << i << ' ' ;
//    exit(0) ;
//}
void Solve(int n)
{
    vector<int> ans ;
    deque<int> d ;
    if(n <= 200)
    {
        us[1] = 1 ;
        d.push_back(1) ;
        for(int i = 1 ; i <= n ; i++)
            abu[i][i] = 1 ;
        vector<int> v ;
        for(int i = 1 ; i <= n ; i++)
            v.push_back(0) ;
        while(d.size() != n)
        {
            for(int i = 1 ; i <= n ; i++)
            {
                if(us[i] || abu[d.back()][i])
                    continue ;
                abu[d.back()][i] = 1 ;
                abu[i][d.back()] = 1 ;
                v[d.back() - 1] = 1 ;
                v[i - 1] = 1 ;
                if(Query(v) == 1)
                {
                    v[d.back() - 1] = 0 ;
                    v[i - 1] = 0 ;
                    us[i] = 1 ;
                    d.push_back(i) ;
                    break ;
                }
                v[d.back() - 1] = 0 ;
                v[i - 1] = 0 ;
            }
            for(int i = 1 ; i <= n ; i++)
            {
                if(us[i] || abu[d[0]][i])
                    continue ;
                abu[d[0]][i] = 1 ;
                abu[i][d[0]] = 1 ;
                v[d[0] - 1] = 1 ;
                v[i - 1] = 1 ;
                if(Query(v) == 1)
                {
                    v[d[0] - 1] = 0 ;
                    v[i - 1] = 0 ;
                    us[i] = 1 ;
                    d.push_front(i) ;
                    break ;
                }
                v[d[0] - 1] = 0 ;
                v[i - 1] = 0 ;
            }
        }
        for(int i : d)
            ans.push_back(i) ;
        Answer(ans) ;
    }
}
//signed main()
//{
//    int n ;
//    cin >> n ;
//    Solve(n) ;
//    return 0 ;
//}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:37:24: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |         while(d.size() != n)
      |               ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 464 KB # of queries: 9118
2 Correct 86 ms 464 KB # of queries: 8342
3 Correct 103 ms 464 KB # of queries: 9130
4 Correct 126 ms 464 KB # of queries: 9931
5 Correct 136 ms 464 KB # of queries: 10690
6 Correct 110 ms 464 KB # of queries: 9463
7 Correct 108 ms 464 KB # of queries: 9434
8 Correct 102 ms 464 KB # of queries: 9948
9 Correct 109 ms 464 KB # of queries: 9738
10 Correct 44 ms 336 KB # of queries: 4008
11 Correct 0 ms 208 KB # of queries: 0
12 Correct 0 ms 208 KB # of queries: 1
13 Correct 0 ms 208 KB # of queries: 2
14 Correct 0 ms 208 KB # of queries: 5
15 Correct 1 ms 208 KB # of queries: 81
16 Correct 3 ms 336 KB # of queries: 214
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 464 KB # of queries: 9118
2 Correct 86 ms 464 KB # of queries: 8342
3 Correct 103 ms 464 KB # of queries: 9130
4 Correct 126 ms 464 KB # of queries: 9931
5 Correct 136 ms 464 KB # of queries: 10690
6 Correct 110 ms 464 KB # of queries: 9463
7 Correct 108 ms 464 KB # of queries: 9434
8 Correct 102 ms 464 KB # of queries: 9948
9 Correct 109 ms 464 KB # of queries: 9738
10 Correct 44 ms 336 KB # of queries: 4008
11 Correct 0 ms 208 KB # of queries: 0
12 Correct 0 ms 208 KB # of queries: 1
13 Correct 0 ms 208 KB # of queries: 2
14 Correct 0 ms 208 KB # of queries: 5
15 Correct 1 ms 208 KB # of queries: 81
16 Correct 3 ms 336 KB # of queries: 214
17 Incorrect 0 ms 208 KB Wrong Answer [7]
18 Halted 0 ms 0 KB -