Wrong Answer
Code
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, q;
cin >> n >> q;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 0; i < q; i++) {
int x, y;
cin >> x >> y;
swap(a[x], a[y]);
}
int count = 0;
for (int i = 1; i <= n; i++) {
if (a[i] == i) {
count++;
}
}
cout << count << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1119 Maximizing Fixed Points
- Contest
- Happy New Year 2025
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-01-02 16:58:47
- Judged At
- 2025-01-02 16:58:47
- Judged By
- Score
- 0
- Total Time
- 813ms
- Peak Memory
- 936.0 KiB