Submission #772266

# Submission time Handle Problem Language Result Execution time Memory
772266 2023-07-03T20:44:42 Z raysh07 Super Dango Maker (JOI22_dango3) C++17
Compilation error
0 ms 0 KB
#include "dango3.h"

#include <vector>

namespace {

int variable_example = 1;

}  // namespace

void Solve(int n, int m) {
  // std::vector<int> x(3);
  // x[0] = 1;
  // x[1] = 2;
  // x[2] = 3;
  // variable_example = Query(x);
  // for (int i = 0; i < M; i++) {
  //   std::vector<int> a(N);
  //   for (int j = 0; j < N; j++) {
  //     a[j] = N * i + j + 1;
  //   }
  //   Answer(a);
  // }

	vector <vector <int>> ans(m);
	vector <int> a(n * m);
	for (int i = 1; i <= n * m; i++){
		int l = 0, r = m - 1;

		while (l != r){
			int mid = (l + r)/2;

			for (auto &x : a) x = 1;

			for (int i = mid + 1; i < m; i++){
				for (auto x : ans[i]) a[x] = 0;
			}
			a[i] = 0;

			vector <int> qry;
			for (int i = 0; i < n * m; i++) if (a[i]) qry.push_back(i + 1);

			int get = Query(qry);

			if (get >= mid) l = mid + 1;
			else r = mid;
		}

		ans[l].push_back(i);
	}

	for (int i = 0; i < m; i++) Answer(ans);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:25:2: error: 'vector' was not declared in this scope
   25 |  vector <vector <int>> ans(m);
      |  ^~~~~~
dango3.cpp:25:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
dango3.cpp:25:18: error: expected primary-expression before 'int'
   25 |  vector <vector <int>> ans(m);
      |                  ^~~
dango3.cpp:26:10: error: expected primary-expression before 'int'
   26 |  vector <int> a(n * m);
      |          ^~~
dango3.cpp:33:19: error: 'a' was not declared in this scope
   33 |    for (auto &x : a) x = 1;
      |                   ^
dango3.cpp:36:19: error: 'ans' was not declared in this scope
   36 |     for (auto x : ans[i]) a[x] = 0;
      |                   ^~~
dango3.cpp:36:27: error: 'a' was not declared in this scope
   36 |     for (auto x : ans[i]) a[x] = 0;
      |                           ^
dango3.cpp:38:4: error: 'a' was not declared in this scope
   38 |    a[i] = 0;
      |    ^
dango3.cpp:40:12: error: expected primary-expression before 'int'
   40 |    vector <int> qry;
      |            ^~~
dango3.cpp:41:46: error: 'qry' was not declared in this scope
   41 |    for (int i = 0; i < n * m; i++) if (a[i]) qry.push_back(i + 1);
      |                                              ^~~
dango3.cpp:43:20: error: 'qry' was not declared in this scope
   43 |    int get = Query(qry);
      |                    ^~~
dango3.cpp:49:3: error: 'ans' was not declared in this scope
   49 |   ans[l].push_back(i);
      |   ^~~
dango3.cpp:52:37: error: 'ans' was not declared in this scope
   52 |  for (int i = 0; i < m; i++) Answer(ans);
      |                                     ^~~
dango3.cpp: At global scope:
dango3.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~