Wrong Answer
Code
#include <bits/stdc++.h>
#define all(a) (a).begin() (a).end()
using namespace std;
void solve() {
int n; cin >> n;
int p[n];
iota(p, p+n, 0);
for (int i = 0; i < n; i += 2)
swap(p[i], p[i+1]);
if (n & 1)
swap(p[n-1], p[n-2]);
for (int x : p) cout << x+1 << " ";
cout << "\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t; while (t--)
solve();
}
Information
- Submit By
- Type
- Submission
- Problem
- P1210 A. Smallest Permutation
- Contest
- Educational Round 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-14 17:08:15
- Judged At
- 2025-07-14 17:08:15
- Judged By
- Score
- 0
- Total Time
- 3ms
- Peak Memory
- 532.0 KiB