Submission #744245

# Submission time Handle Problem Language Result Execution time Memory
744245 2023-05-18T09:57:37 Z MON Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;

void Solve(int N)
{
	vector<int> m(N,0);
	vector<int> vecini[N + 1]; int luat[N] = {0};
	for(int i = 0 ; i < N - 1 ; i++)
        {
            for(int j = 0 ; j < N ; j++)
                {
                    m[i] = 1;
                    m[j] = 1;

                    int sunt = query(M) & 1;
                    if(sunt) vecini[i].emplace_back(j),vecini[j].emplace_back(i);
                }
        }

    vector<int> ans;
    for(int i = 0; i < N ; i++)
        {
            if(vecini[i].size() == 1)
                {
                    ans.emplace_back(i + 1);
                    break;
                }
        }

    while(ans.size() != N)
        {
            for(auto &it : vecini[ans.back()])
                {
                    if(!luat[it])
                        {
                            luat[it] = 1;
                            ans.emplace_back(it + 1);
                        }
                }
        }

    Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:17:38: error: 'M' was not declared in this scope
   17 |                     int sunt = query(M) & 1;
      |                                      ^
library.cpp:17:32: error: 'query' was not declared in this scope; did you mean 'Query'?
   17 |                     int sunt = query(M) & 1;
      |                                ^~~~~
      |                                Query
library.cpp:32:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     while(ans.size() != N)
      |           ~~~~~~~~~~~^~~~