Submission #581809

# Submission time Handle Problem Language Result Execution time Memory
581809 2022-06-23T06:41:21 Z Abdulmohsen1284 Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include"bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//---------------------------------------------------------------------------------------

#include <cstdio>
#include <vector>
//#include "library.h"
using namespace std;
long long s=0;
void rec(long long cur,vector <int> grp)
{
    long long fr=Query(grp);
    grp.push_back(cur);
    if(fr+1==Query(qrp))
    {
        if(grp.size()==1)
        {
            s=grp[0];
        }
        vector <int> on,tw;
        for(int i=0;i<grp.size()/2;i++)
        {
            on.push_back(grp[i]);
        }
        for(int i=grp.size()/2;i<grp.size();i++)
        {
            tw.push_back(grp[i]);
        }
        rec(st,on);
        rec(st,tw);
    }
    else
        return;
}

void Solve(int N)
{
    for(int i=1;i<=N;i++)
    {
        vector <int> ask;
        for(int j=1;j<=N;j++)
        {
            if(i==j)
                continue;
            ask.push_back(j);
        }
        long long ans=Query(ask);
        if(ans==1)
        {
            s=i;
            break;
        }
    }
    vector <int> ret,lef;
    ret.push_back(st);
    for(int i=1;i<=N;i++)
    {
        if(s==i)
            continue;
        lef.push_back(i);
    }
    for(int i=1;i<N;i++)
    {
        rec(s,lef);
        ret.push_back(s);
    }
    Answer(ret);
}

Compilation message

library.cpp: In function 'void rec(long long int, std::vector<int>)':
library.cpp:19:18: error: 'Query' was not declared in this scope
   19 |     long long fr=Query(grp);
      |                  ^~~~~
library.cpp:21:20: error: 'qrp' was not declared in this scope; did you mean 'grp'?
   21 |     if(fr+1==Query(qrp))
      |                    ^~~
      |                    grp
library.cpp:28:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int i=0;i<grp.size()/2;i++)
      |                     ~^~~~~~~~~~~~~
library.cpp:32:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(int i=grp.size()/2;i<grp.size();i++)
      |                                ~^~~~~~~~~~~
library.cpp:36:13: error: 'st' was not declared in this scope; did you mean 's'?
   36 |         rec(st,on);
      |             ^~
      |             s
library.cpp: In function 'void Solve(int)':
library.cpp:54:23: error: 'Query' was not declared in this scope
   54 |         long long ans=Query(ask);
      |                       ^~~~~
library.cpp:62:19: error: 'st' was not declared in this scope; did you mean 's'?
   62 |     ret.push_back(st);
      |                   ^~
      |                   s
library.cpp:74:5: error: 'Answer' was not declared in this scope
   74 |     Answer(ret);
      |     ^~~~~~