prog.cpp:3:18: error: ‘vector’ has not been declared
int minSwaps(vector<int>& nums, vector<int>& forbidden) {
^~~~~~
prog.cpp:3:24: error: expected ‘,’ or ‘...’ before ‘<’ token
int minSwaps(vector<int>& nums, vector<int>& forbidden) {
^
prog.cpp: In member function ‘int Solution::minSwaps(int)’:
prog.cpp:4:17: error: ‘nums’ was not declared in this scope
int n = nums.size();
^~~~
prog.cpp:4:17: note: suggested alternative: ‘enum’
int n = nums.size();
^~~~
enum
prog.cpp:7:9: error: ‘unordered_map’ was not declared in this scope
unordered_map<int, int> bad; // value -> conflict count
^~~~~~~~~~~~~
prog.cpp:7:23: error: expected primary-expression before ‘int’
unordered_map<int, int> bad; // value -> conflict count
^~~
prog.cpp:8:23: error: expected primary-expression before ‘int’
unordered_map<int, int> cntN; // value -> count in nums
^~~
prog.cpp:9:23: error: expected primary-expression before ‘int’
unordered_map<int, int> cntF; // value -> count in forbidden
^~~
prog.cpp:12:13: error: ‘cntN’ was not declared in this scope
cntN[nums[i]]++;
^~~~
prog.cpp:12:13: note: suggested alternative: ‘int’
cntN[nums[i]]++;
^~~~
int
prog.cpp:13:13: error: ‘cntF’ was not declared in this scope
cntF[forbidden[i]]++;
^~~~
prog.cpp:13:13: note: suggested alternative: ‘int’
cntF[forbidden[i]]++;
^~~~
int
prog.cpp:13:18: error: ‘forbidden’ was not declared in this scope
cntF[forbidden[i]]++;
^~~~~~~~~
prog.cpp:16:17: error: ‘bad’ was not declared in this scope
bad[nums[i]]++;
^~~
prog.cpp:21:19: warning: structured bindings only available with -std=c++17 or -std=gnu++17
for (auto [val, cnt] : cntN) {
^
prog.cpp:21:32: error: ‘cntN’ was not declared in this scope
for (auto [val, cnt] : cntN) {
^~~~
prog.cpp:21:32: note: suggested alternative: ‘cnt’
for (auto [val, cnt] : cntN) {
^~~~
cnt
prog.cpp:22:29: error: ‘cntF’ was not declared in this scope
int forbSpots = cntF[val];
^~~~
prog.cpp:22:29: note: suggested alternative: ‘int’
int forbSpots = cntF[val];
^~~~
int
prog.cpp:29:9: error: ‘priority_queue’ was not declared in this scope
priority_queue<int> pq;
^~~~~~~~~~~~~~
prog.cpp:29:24: error: expected primary-expression before ‘int’
priority_queue<int> pq;
^~~
prog.cpp:30:19: warning: structured bindings only available with -std=c++17 or -std=gnu++17
for (auto [val, cnt] : bad) {
^
prog.cpp:30:32: error: ‘bad’ was not declared in this scope
for (auto [val, cnt] : bad) {
^~~
prog.cpp:31:13: error: ‘pq’ was not declared in this scope
pq.push(cnt);
^~
prog.cpp:37:16: error: ‘pq’ was not declared in this scope
while (pq.size() >= 2) {
^~
prog.cpp:48:14: error: ‘pq’ was not declared in this scope
if (!pq.empty()) {
^~