답안 #988990

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988990 2024-05-27T09:34:12 Z steveonalex 자동 인형 (IOI18_doll) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "doll.h"
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define MASK(i) (1ULL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ull mask){return __builtin_ctzll(mask);}
int logOf(ull mask){return 63 - __builtin_clzll(mask);}
 
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
 
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }
 
template <class T>
    void printArr(T container, string separator = " ", string finish = "\n", ostream &out = cout){
        for(auto item: container) out << item << separator;
        out << finish;
    }
 
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

void create_circuit(int m, vector<int> a) {
    int n = A.size();
    a.push_back(0);
    vector<vector<int>> fw(n+1);
    for(int i = 0; i<n; ++i){
        fw[a[i]].push_back(a[i+1]);
    }
    fw[0].push_back(a[0]);

    vector<int> C(m+1, 0);
    vector<int> X, Y;
    for(int i = 0; i<=n; ++i) {
        if (fw[i].size() > 2) exit(1);
        if (fw[i].size() == 0) continue;
        if (fw[i].size() == 1) C[i] = fw[i][0];
        if (fw[i].size() == 2){
            int cur = X.size(); cur = -cur - 1;
            C[i] = cur;
            X.push_back(fw[i][0]);
            Y.push_back(fw[i][1]);
        }
    }
    answer(C, X, Y);
}


// int main(void){
//     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
    
 
//     return 0;
// }

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:49:13: error: 'A' was not declared in this scope
   49 |     int n = A.size();
      |             ^