답안 #547597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
547597 2022-04-11T04:28:05 Z flashhh Ancient Machine (JOI21_ancient_machine) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
include "Anna.h"

using namespace std;

void send(char x) {
    if (x == 'X') {
        Send(0);
        Send(0);
    }
    else if (x == 'Y') {
        Send(0);
        Send(1);
    }
    else {
        Send(1);
        Send(0);
    }
}

void Anna(int n,vector<char> s) {
    for (int i=0;i<n;++i) send(s[i]);
}
#include <bits/stdc++.h>
#include "Bruno.h"
#define N 100005
#define pii pair<int,int>
#define fi first
#define se second
#define pb emplace_back
#define getbit(x,y) (((x)>>(y))&1)
#define getoff(x,y) ((x)^(1<<(y)))

using namespace std;

int n,l,dp[1<<18],trace[1<<18];
char a[N];
vector<int> s;

int dq(int mask) {
    if (mask == 0) return 0;
    if (dp[mask] != -1) return dp[mask];

    vector<int> vt;
    for (int i=1;i<=n;++i)
        if (getbit(mask,i-1)) vt.pb(i);

    int ans = 0;

    for (int e=0;e<(int)vt.size();++e) {
        bool ok1 = 0; bool ok2 = 0; bool ok3 = 0;

        if (e > 0 && a[vt[e-1]] == 'X') ok1 = 1;
        if (a[vt[e]] == 'Y') ok2 = 1;
        if (e+1 < (int)vt.size() && a[vt[e+1]] == 'Z') ok3 = 1;

        int kq = dq(getoff(mask, vt[e]-1)) + (ok1&ok2&ok3);
        if (ans <= kq) {
            ans = kq;
            trace[mask] = vt[e];
        }
    }

    return dp[mask] = ans;
}

void dq2(int mask) {
    if (mask == 0) return;

    Remove(trace[mask]);
    dq2(getoff(mask,trace[mask]-1));
}

void Bruno(int n1,int l1,vector<int> s1) {
    n = n1; l = l1; s = s1;

    for (int i=0;i<n;++i)
        if (s[i<<1] == 0) {
            if (s[i<<1|1] == 0) a[i+1] = 'X';
            else a[i+1] = 'Y';
        }
        else a[i+1] = 'Z';

    memset(dp,-1,sizeof(dp));
    dq((1<<n)-1);
    dq2((1<<n)-1);
}

Compilation message

Anna.cpp:2:1: error: 'include' does not name a type
    2 | include "Anna.h"
      | ^~~~~~~
Anna.cpp: In function 'void send(char)':
Anna.cpp:8:9: error: 'Send' was not declared in this scope; did you mean 'send'?
    8 |         Send(0);
      |         ^~~~
      |         send
Anna.cpp:12:9: error: 'Send' was not declared in this scope; did you mean 'send'?
   12 |         Send(0);
      |         ^~~~
      |         send
Anna.cpp:16:9: error: 'Send' was not declared in this scope; did you mean 'send'?
   16 |         Send(1);
      |         ^~~~
      |         send
Anna.cpp: At global scope:
Anna.cpp:21:17: error: 'vector' has not been declared
   21 | void Anna(int n,vector<char> s) {
      |                 ^~~~~~
Anna.cpp:21:23: error: expected ',' or '...' before '<' token
   21 | void Anna(int n,vector<char> s) {
      |                       ^
Anna.cpp: In function 'void Anna(int, int)':
Anna.cpp:22:32: error: 's' was not declared in this scope
   22 |     for (int i=0;i<n;++i) send(s[i]);
      |                                ^