sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:2:9: error: 'vector' was not declared in this scope
2 | vector<int> a(N), inv_a(N);
| ^~~~~~
sorting.cpp:2:16: error: expected primary-expression before 'int'
2 | vector<int> a(N), inv_a(N);
| ^~~
sorting.cpp:4:12: error: expected primary-expression before 'int'
4 | vector<int> b(N);
| ^~~
sorting.cpp:6:17: error: 'b' was not declared in this scope
6 | b[i]=S[i];
| ^
sorting.cpp:9:9: error: 'a' was not declared in this scope
9 | a[i] = i;
| ^
sorting.cpp:10:9: error: 'inv_a' was not declared in this scope
10 | inv_a[i] = i;
| ^~~~~
sorting.cpp: In lambda function:
sorting.cpp:16:16: error: expected primary-expression before 'int'
16 | vector<int> ca = a;
| ^~~
sorting.cpp:17:41: error: 'ca' was not declared in this scope; did you mean 'can'?
17 | for(int i = 0; i < t; i++) swap(ca[X[i]], ca[Y[i]]);
| ^~
| can
sorting.cpp:17:36: error: 'swap' was not declared in this scope
17 | for(int i = 0; i < t; i++) swap(ca[X[i]], ca[Y[i]]);
| ^~~~
sorting.cpp:19:16: error: expected primary-expression before 'int'
19 | vector<int> pi(N);
| ^~~
sorting.cpp:20:36: error: 'pi' was not declared in this scope; did you mean 'i'?
20 | for(int i = 0; i < N; i++) pi[i] = b[ca[i]];
| ^~
| i
sorting.cpp:20:44: error: 'b' was not declared in this scope
20 | for(int i = 0; i < N; i++) pi[i] = b[ca[i]];
| ^
sorting.cpp:20:46: error: 'ca' was not declared in this scope; did you mean 'can'?
20 | for(int i = 0; i < N; i++) pi[i] = b[ca[i]];
| ^~
| can
sorting.cpp:21:16: error: expected primary-expression before 'bool'
21 | vector<bool> vis(N, false);
| ^~~~
sorting.cpp:24:17: error: 'vis' was not declared in this scope
24 | if(!vis[i]){
| ^~~
sorting.cpp:29:25: error: 'pi' was not declared in this scope; did you mean 'i'?
29 | x = pi[x];
| ^~
| i
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:49:14: error: 'a' was not declared in this scope
49 | swap(a[X[i]], a[Y[i]]);
| ^
sorting.cpp:49:9: error: 'swap' was not declared in this scope
49 | swap(a[X[i]], a[Y[i]]);
| ^~~~
sorting.cpp:50:9: error: 'inv_a' was not declared in this scope
50 | inv_a[a[X[i]]] = X[i];
| ^~~~~
sorting.cpp:54:12: error: expected primary-expression before 'int'
54 | vector<int> pi(N);
| ^~~
sorting.cpp:55:32: error: 'pi' was not declared in this scope; did you mean 'i'?
55 | for(int i = 0; i < N; i++) pi[i] = b[a[i]];
| ^~
| i
sorting.cpp:55:40: error: 'b' was not declared in this scope
55 | for(int i = 0; i < N; i++) pi[i] = b[a[i]];
| ^
sorting.cpp:55:42: error: 'a' was not declared in this scope
55 | for(int i = 0; i < N; i++) pi[i] = b[a[i]];
| ^
sorting.cpp:56:12: error: expected primary-expression before 'bool'
56 | vector<bool> vis(N, false);
| ^~~~
sorting.cpp:57:12: error: 'pair' was not declared in this scope
57 | vector<pair<int,int>> ops;
| ^~~~
sorting.cpp:57:17: error: expected primary-expression before 'int'
57 | vector<pair<int,int>> ops;
| ^~~
sorting.cpp:60:13: error: 'vis' was not declared in this scope
60 | if(!vis[i]){
| ^~~
sorting.cpp:61:20: error: expected primary-expression before 'int'
61 | vector<int> cyc;
| ^~~
sorting.cpp:65:17: error: 'cyc' was not declared in this scope
65 | cyc.push_back(x);
| ^~~
sorting.cpp:66:21: error: 'pi' was not declared in this scope; did you mean 'i'?
66 | x = pi[x];
| ^~
| i
sorting.cpp:69:17: error: 'size_t' was not declared in this scope
69 | for(size_t j = 1; j < cyc.size(); j++){
| ^~~~~~
sorting.cpp:1:1: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
+++ |+#include <cstddef>
1 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]){
sorting.cpp:69:35: error: 'cyc' was not declared in this scope
69 | for(size_t j = 1; j < cyc.size(); j++){
| ^~~
sorting.cpp:69:31: error: 'j' was not declared in this scope
69 | for(size_t j = 1; j < cyc.size(); j++){
| ^
sorting.cpp:72:17: error: 'ops' was not declared in this scope
72 | ops.emplace_back(a[u], a[v]);
| ^~~
sorting.cpp:72:34: error: 'a' was not declared in this scope
72 | ops.emplace_back(a[u], a[v]);
| ^
sorting.cpp:72:42: error: 'v' was not declared in this scope
72 | ops.emplace_back(a[u], a[v]);
| ^
sorting.cpp:73:22: error: 'b' was not declared in this scope
73 | swap(b[a[u]], b[a[v]]);
| ^
sorting.cpp:73:17: error: 'swap' was not declared in this scope
73 | swap(b[a[u]], b[a[v]]);
| ^~~~
sorting.cpp:78:16: error: 'ops' was not declared in this scope
78 | while((int)ops.size() < best) ops.emplace_back(0, 0);
| ^~~
sorting.cpp:82:22: error: 'ops' was not declared in this scope
82 | P[i]=ops[i].first;
| ^~~