Submission #1039149

# Submission time Handle Problem Language Result Execution time Memory
1039149 2024-07-30T13:48:00 Z MeGustaElArroz23 popa (BOI18_popa) C++17
Compilation error
0 ms 0 KB
    #include <bits/stdc++.h>
    #include "popa.h"

    int solve(int N, int* Left, int* Right) {
        
        for (int i = 0; i < N; i++) {
            Left[i] = -1;
            Right[i] = -1;
        }

        bool respuesta = query(0,0,0,0);
        
        return 0;
    }

    void test(int N) {
        int* Left = new int[N];
        int* Right = new int[N];

        int root = solve(N, Left, Right);
        cout << "Root: " << root << endl;

        for (int i = 0; i < N; i++) {
            cout << Left[i] << " " << Right[i] << endl;
        }
    }

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:11:14: warning: unused variable 'respuesta' [-Wunused-variable]
   11 |         bool respuesta = query(0,0,0,0);
      |              ^~~~~~~~~
popa.cpp: In function 'void test(int)':
popa.cpp:21:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |         cout << "Root: " << root << endl;
      |         ^~~~
      |         std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75,
                 from popa.cpp:1:
/usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
popa.cpp:21:37: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   21 |         cout << "Root: " << root << endl;
      |                                     ^~~~
      |                                     std::endl
In file included from /usr/include/c++/10/istream:39,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from popa.cpp:1:
/usr/include/c++/10/ostream:681:5: note: 'std::endl' declared here
  681 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~