Submission #1262863

#TimeUsernameProblemLanguageResultExecution timeMemory
1262863norman165Super Dango Maker (JOI22_dango3)C++20
Compilation error
0 ms0 KiB
#include "dango3.h"
#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
#define yes() cout << "YES\n"
#define no() cout << "NO\n"

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

const int inf = 1e18;
const int mod = 1e9 + 7;
const int maxn = 1e6;
const int mod1 = 998244353;
const int mod2 = 1e18 + 1;
const int mod3 = 1e9 + 9;
const int mod4 = 333333333;
const int mod5 = 200000;
const int mod6 = 10007;
const int k = 3000;
const int w = 1e5;
const ld EPS = 1e-8;

int LOG = 30;

int ask(vector<int>& a) {
    return Query(a);
}

void solve() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> ans;
    set<int> st;
    while (m--) {
        vector<int> res;

        int idx = -1;
        for (int i = 0; i < n * m; i++) {
            vector<int> go;
            for (int j = 0; j <= i; j++) if (!st.count(j)) go.push_back(j + 1);
            if (ask(go)) {
                idx = i;
                break;
            }
        }

        res.push_back(idx);
        st.insert(idx);

        for (int i = idx - 1; i >= -1; i--) {
            vector<int> go;
            for (int j = 0; j <= i; j++) if (!st.count(j)) go.push_back(j + 1);
            for (int& j : res) go.push_back(j + 1);
            if (ask(go) == 0) {
                res.push_back(i + 1);
            }
        }

        ans.push_back(res);
    }

    for (auto& i : ans) Answer(i);
}

signed main() {
    // cout.precision(16);

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }
}

Compilation message (stderr)

dango3.cpp: In function 'long long int ask(std::vector<long long int>&)':
dango3.cpp:31:18: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   31 |     return Query(a);
      |                  ^
In file included from dango3.cpp:1:
dango3.h:5:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    5 | int Query(const std::vector<int> &x);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
dango3.cpp: In function 'void solve()':
dango3.cpp:68:32: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   68 |     for (auto& i : ans) Answer(i);
      |                                ^
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);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^