제출 #772267

#제출 시각아이디문제언어결과실행 시간메모리
772267raysh07Super Dango Maker (JOI22_dango3)C++17
컴파일 에러
0 ms0 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; 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); }

컴파일 시 표준 에러 (stderr) 메시지

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:52:37: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<std::vector<int> >'
   52 |  for (int i = 0; i < m; i++) Answer(ans);
      |                                     ^~~
In file included from dango3.cpp:1:
dango3.h:6:37: note: in passing argument 1 of 'void Answer(const std::vector<int>&)'
    6 | void Answer(const std::vector<int> &a);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^
dango3.cpp: At global scope:
dango3.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~