My solution for CLEANUP goes as follows:
#include <iostream>
#include <set>
#include <vector>
#define lo unsigned long long
using namespace std;
void solve(lo M, lo N,lo a[]){
set<lo> s;
vector<lo> v;
vector<lo> j;
vector<lo> k;
bool polar = true;
//creates list of 1,2..M
for (lo x = 1; x<=M;x++){
s.insert(x);
}
//deletes terms
for (lo x = 0; x<N;x++){
s.erase(a[x]);
}
for (auto x : s) {
v.push_back(x);
}
for (lo x = 0; x<v.size();x+=2){
j.push_back(v[x]);
}
for (lo x = 1; x<v.size();x+=2){
k.push_back(v[x]);
}
for (auto x : j) {
cout << x << " ";
}
cout << endl;
for (auto x : k) {
cout << x << " ";
}
cout << endl;
}
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
lo T;
cin >> T;
lo M,N = 0;
lo a[N];
for (lo x = 0; x<T;x++){
cin >> M >> N;
for (lo y = 0; y<N;y++){
cin >> a[y];
}
solve(M,N,a);
}
return 0;
}
However I seem to be getting wrong answers. I suspect this is because of how I used for loops. I tried to use increments of 2, however I’m not sure if that causes overflow or not(goes past the set limit). Can anyone confirm? Thanks