답안 #160044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
160044 2019-10-25T18:35:58 Z combi1k1 도서관 (JOI18_library) C++14
0 / 100
626 ms 636 KB
#include<bits/stdc++.h>
#include "library.h"

using namespace std;

vector<int> ASK;

int ask(vector<int> v)  {
    if (v.size() == 1)  return  1;
    for(int &x : ASK)   x = 0;
    for(int &x : v)     ASK[x - 1] = 1;

    return  Query(ASK);
}

int Connected(int u,vector<int> v)  {
    int a = ask(v); v.push_back(u);
    int b = ask(v); return  a >= b;
}
vector<int> g[1001];

void Solve(int n)   {
    ASK.resize(n);
    for(int i = 1 ; i <= n ; ++i)   {
        vector<int> v;

        int x = i;
        int y = 0;

        if (g[i].size())    y = g[i][0];

        for(int j = 1 ; j <= n ; ++j)   if (j != x && j != y)
            v.push_back(j);

        int l = 0;
        int r = v.size();

        for(; l < r ;)  {
            int m = (l + r) / 2;
            if (Connected(i,vector<int>(v.begin() + l,v.begin() + m + 1)))
                r = m;
            else
                l = m + 1;
        }
        if (l < v.size())   {
            x = v[l];
            g[i].push_back(x);
            g[x].push_back(i);
        }
    }
    vector<int> res;

    for(int i = 1 ; i <= n ; ++i)   if (g[i].size() == 1)   {
        int x = i;
        res.push_back(0);

        for(int j = 0 ; j < n ; ++j)
        for(int u : g[x])   if (u != res.back())    {
            res.push_back(x);
            x = u;  break;
        }
        res.push_back(x);
        res.erase(res.begin());

        Answer(res);    return;
    }
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:45:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (l < v.size())   {
             ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 45 ms 340 KB Wrong Answer [4]
2 Incorrect 37 ms 344 KB Wrong Answer [4]
3 Incorrect 52 ms 376 KB Wrong Answer [4]
4 Incorrect 62 ms 376 KB Wrong Answer [4]
5 Incorrect 56 ms 424 KB Wrong Answer [4]
6 Incorrect 61 ms 376 KB Wrong Answer [4]
7 Incorrect 59 ms 352 KB Wrong Answer [4]
8 Incorrect 59 ms 248 KB Wrong Answer [4]
9 Incorrect 55 ms 376 KB Wrong Answer [4]
10 Incorrect 27 ms 340 KB Wrong Answer [4]
11 Incorrect 2 ms 248 KB Wrong Answer [7]
12 Correct 2 ms 248 KB # of queries: 1
13 Correct 2 ms 248 KB # of queries: 7
14 Correct 2 ms 248 KB # of queries: 12
15 Correct 3 ms 376 KB # of queries: 105
16 Incorrect 7 ms 376 KB Wrong Answer [4]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 45 ms 340 KB Wrong Answer [4]
2 Incorrect 37 ms 344 KB Wrong Answer [4]
3 Incorrect 52 ms 376 KB Wrong Answer [4]
4 Incorrect 62 ms 376 KB Wrong Answer [4]
5 Incorrect 56 ms 424 KB Wrong Answer [4]
6 Incorrect 61 ms 376 KB Wrong Answer [4]
7 Incorrect 59 ms 352 KB Wrong Answer [4]
8 Incorrect 59 ms 248 KB Wrong Answer [4]
9 Incorrect 55 ms 376 KB Wrong Answer [4]
10 Incorrect 27 ms 340 KB Wrong Answer [4]
11 Incorrect 2 ms 248 KB Wrong Answer [7]
12 Correct 2 ms 248 KB # of queries: 1
13 Correct 2 ms 248 KB # of queries: 7
14 Correct 2 ms 248 KB # of queries: 12
15 Correct 3 ms 376 KB # of queries: 105
16 Incorrect 7 ms 376 KB Wrong Answer [4]
17 Incorrect 567 ms 636 KB Wrong Answer [4]
18 Incorrect 583 ms 516 KB Wrong Answer [4]
19 Incorrect 626 ms 348 KB Wrong Answer [4]
20 Incorrect 543 ms 376 KB Wrong Answer [4]
21 Incorrect 466 ms 376 KB Wrong Answer [4]
22 Incorrect 585 ms 424 KB Wrong Answer [4]
23 Incorrect 596 ms 508 KB Wrong Answer [4]
24 Incorrect 146 ms 344 KB Wrong Answer [4]
25 Incorrect 616 ms 508 KB Wrong Answer [4]
26 Incorrect 530 ms 608 KB Wrong Answer [4]
27 Incorrect 189 ms 340 KB Wrong Answer [4]
28 Correct 577 ms 616 KB # of queries: 18975
29 Correct 559 ms 504 KB # of queries: 18955
30 Correct 598 ms 504 KB # of queries: 18975