Submission #160042

# Submission time Handle Problem Language Result Execution time Memory
160042 2019-10-25T18:31:36 Z combi1k1 Library (JOI18_library) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
#include "library.h"

using namespace std;

int ask(vector<int> v)  {   return  v.size() == 1 ? 1 : Query(v);   }

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)   {
    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);    break;
    }
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:36:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (l < v.size())   {
             ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Wrong Answer [1]
2 Incorrect 2 ms 376 KB Wrong Answer [1]
3 Incorrect 2 ms 376 KB Wrong Answer [1]
4 Incorrect 2 ms 376 KB Wrong Answer [1]
5 Incorrect 2 ms 248 KB Wrong Answer [1]
6 Incorrect 2 ms 376 KB Wrong Answer [1]
7 Incorrect 2 ms 376 KB Wrong Answer [1]
8 Incorrect 2 ms 376 KB Wrong Answer [1]
9 Incorrect 1 ms 376 KB Wrong Answer [1]
10 Incorrect 2 ms 248 KB Wrong Answer [1]
11 Incorrect 2 ms 252 KB Wrong Answer [7]
12 Incorrect 2 ms 248 KB Expected integer, but "wa" found
13 Incorrect 2 ms 248 KB Wrong Answer [1]
14 Incorrect 2 ms 248 KB Wrong Answer [1]
15 Incorrect 2 ms 376 KB Wrong Answer [1]
16 Incorrect 2 ms 376 KB Wrong Answer [1]
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Wrong Answer [1]
2 Incorrect 2 ms 376 KB Wrong Answer [1]
3 Incorrect 2 ms 376 KB Wrong Answer [1]
4 Incorrect 2 ms 376 KB Wrong Answer [1]
5 Incorrect 2 ms 248 KB Wrong Answer [1]
6 Incorrect 2 ms 376 KB Wrong Answer [1]
7 Incorrect 2 ms 376 KB Wrong Answer [1]
8 Incorrect 2 ms 376 KB Wrong Answer [1]
9 Incorrect 1 ms 376 KB Wrong Answer [1]
10 Incorrect 2 ms 248 KB Wrong Answer [1]
11 Incorrect 2 ms 252 KB Wrong Answer [7]
12 Incorrect 2 ms 248 KB Expected integer, but "wa" found
13 Incorrect 2 ms 248 KB Wrong Answer [1]
14 Incorrect 2 ms 248 KB Wrong Answer [1]
15 Incorrect 2 ms 376 KB Wrong Answer [1]
16 Incorrect 2 ms 376 KB Wrong Answer [1]
17 Incorrect 2 ms 376 KB Wrong Answer [1]
18 Incorrect 2 ms 376 KB Wrong Answer [1]
19 Incorrect 2 ms 248 KB Wrong Answer [1]
20 Incorrect 2 ms 376 KB Wrong Answer [1]
21 Incorrect 2 ms 252 KB Wrong Answer [1]
22 Incorrect 2 ms 248 KB Wrong Answer [1]
23 Incorrect 2 ms 248 KB Wrong Answer [1]
24 Incorrect 2 ms 248 KB Wrong Answer [1]
25 Incorrect 2 ms 376 KB Wrong Answer [1]
26 Incorrect 2 ms 376 KB Wrong Answer [1]
27 Incorrect 2 ms 376 KB Wrong Answer [1]
28 Incorrect 2 ms 376 KB Wrong Answer [1]
29 Incorrect 2 ms 252 KB Wrong Answer [1]
30 Incorrect 2 ms 248 KB Wrong Answer [1]