fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. const int N = 1e5 + 5;
  7.  
  8. int A[N], P[N], P_map[N];
  9. vector<int> segTree(4 * N);
  10.  
  11. // ... (rest of the code remains the same)
  12.  
  13. int main() {
  14. int N, Q;
  15. cin >> N >> Q;
  16. for (int i = 1; i <= N; i++) {
  17. cin >> P[i];
  18. P_map[P[i]] = i;
  19. }
  20.  
  21. // ... (rest of the code remains the same)
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5296KB
stdin
5 6
3 1 5 4 2
0 2 4 2
1 2 4 3
2 3 4
0 2 5 1
3 2 4
3 1 3
stdout
Standard output is empty