답안 #553206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
553206 2022-04-25T05:54:41 Z Killer2501 카멜레온의 사랑 (JOI20_chameleon) C++14
컴파일 오류
0 ms 0 KB
#include "chameleon.h"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pll pair<int, pii>
#define pii pair<int, int>
#define fi first
#define se second
using namespace std;
const int N = 1e5+2;
const int M = 60;
const int mod = 1e9+7;
const ll base = 1e6;
const ll inf = 1e9;
int n, m, b[N], a[N], k, t, d[N], cnt, par[N], f[N];
ll ans;
vector<int> adj[N];
bool vis[N], ok;

bool ask(vector<int> vi, int x)
{
    if(vi.empty())return false;
    vi.pb(x);
    return Query(vi) != (int) vi.size();
}
void Solve(int n)
{
    n *= 2;
    for(int i = 1; i <= n; i ++)
    {
        vector<int> group[2];
        fill_n(a, i, -1);
        for(int j = 1; j < i; j ++)
        {
            if(a[j] != -1)
            {
                a[j] = 0;
                for(int p: adj[j])a[p] = 1;
            }
            group[a[j]].pb(j);
        }
        for(int j = 0; j < 2; j ++)
        {
            while(ask(group[j], i))
            {
                int l = 1, r = group.size(), mid;
                while(l <= r)
                {
                    mid = (l+r)>>1;
                    if(ask(vector<int>(group[j].begin(), group[j].begin()+mid), i))r = mid-1;
                    else l = mid+1;
                }
                adj[group[j][l-1]].pb(i);
                adj[i].pb(group[j][l-1]);
                group[j].erase(group[j].begin(), group[j].begin()+l);
            }
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        if(adj[i].size() == 1)
        {
            b[i] = adj[i][0];
            continue;
        }
        for(int l = 0; l < 3; l ++)
        {
            for(int r = l+1; r < 3; r ++)
            {
                if(Query({i, adj[i][l], adj[i][r]}) == 3)
                {
                    b[i] = adj[i][3^l^r];
                    break;
                }
            }
            if(b[i])break;
        }
    }
    for(int i = 1; i <= n; i ++)
    {
        if(b[i] > i)Answer(i, b[i]);
    }
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:48:38: error: request for member 'size' in 'group', which is of non-class type 'std::vector<int> [2]'
   48 |                 int l = 1, r = group.size(), mid;
      |                                      ^~~~
chameleon.cpp:51:21: error: 'mid' was not declared in this scope; did you mean 'mod'?
   51 |                     mid = (l+r)>>1;
      |                     ^~~
      |                     mod