답안 #881526

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881526 2023-12-01T11:36:53 Z Regulus Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

const int N = 105;
ll nn, mm, cnt[N], a[N];
vector<ll> v[N];

inline void dfs(int d)
{
    if (d > nn*mm)
    {
        int i, j, ret;
        for (i=0; i < mm; ++i)
        {
            v[i].clear();
            for (j=1; j <= nn; ++j) v[i].pb(a[i*mm+j]);
            ret = Query(v[i]);
            if (ret != 1) break;
        }
        if (i == mm)
        {
            for (i=0; i < mm; ++i) Answer(v[i]);
            exit(0);
        }
        return;
    }

    for (int i=1; i <= 4; ++i)
    {
        if (!cnt[i]) continue;
        ans[d] = i, --cnt[i];
        dfs(d+1);
        ++cnt[i];
    }
}

void Solve(int n, int m)
{
    ll i, j;

    nn = n, mm = m;
    dfs(1);
}

Compilation message

dango3.cpp: In function 'void dfs(int)':
dango3.cpp:29:28: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   29 |             ret = Query(v[i]);
      |                         ~~~^
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:34:46: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   34 |             for (i=0; i < mm; ++i) Answer(v[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);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^
dango3.cpp:43:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |         ans[d] = i, --cnt[i];
      |         ^~~
      |         abs
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:51:8: warning: unused variable 'i' [-Wunused-variable]
   51 |     ll i, j;
      |        ^
dango3.cpp:51:11: warning: unused variable 'j' [-Wunused-variable]
   51 |     ll i, j;
      |           ^