// AM+DG
/*
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
#define L(i, varmn, varmx) for(ll i = varmn; i < varmx; i++)
#define LR(i, varmx, varmn) for(ll i = varmx; i > varmn; i--)
#define LI(i, varmn, varmx) for(int i = varmn; i < varmx; i++)
#define LIR(i, varmx, varmn) for(int i = varmx; i > varmn; i--)
#define pb push_back
#include "doll.h"
void create_circuit(int m, std::vector<int> a) {
int n = a.size();
vi c(M + 1);
c[0] = -1;
for (int i = 1; i <= M; ++i) {
c[i] = 1;
}
// vi x(N), y(N);
// for (int k = 0; k < N; ++k) {
// x[k] = y[k] = a[k];
// }
vi x;
vi y;
vvi adjmat;
LI(i, 0, m + 1) {
vi adjmatr;
adjmat.pb(adjmatr);
}
LI(i, -1, n) {
if(i == -1) {
adjmat[0].pb(a[i + 1]);
} else if(i == n - 1) {
adjmat[a[i]].pb(0);
} else {
adjmat[a[i]].pb(a[i + 1]);
}
}
int last_switch = 0;
LI(i, 0, m + 1) {
int cur_switch_size = adjmat[i].size();
if(cur_switch_size == 1) {
c[i] = adjmat[i][0];
} else {
// ! TODO later!
// construct_switches(last_switch, );
// last_switch -= cur_switch_size - 1;
}
}
answer(c, x, y);
return;
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:26:10: error: 'M' was not declared in this scope
26 | vi c(M + 1);
| ^
doll.cpp:56:9: warning: unused variable 'last_switch' [-Wunused-variable]
56 | int last_switch = 0;
| ^~~~~~~~~~~