/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 2ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sp " "
#define all(x) x.begin(),x.end()
#define FastAF ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

template <typename T> // cin >> vector<T> 
istream &operator>>(istream &istream, vector<T> &v){for (auto &it : v) cin >> it;return istream;}
template <typename T> // cout << vector<T>
ostream &operator<<(ostream &ostream, const vector<T> &c){for (auto &it : c) cout << it << " ";return ostream;}

int main(){
    FastAF
    // #ifndef ONLINE_JUDGE
    //     freopen("D:/Competitive-Programming/Stream/input.txt","r",stdin);
    //     freopen("D:/Competitive-Programming/Stream/output.txt","w",stdout);
    // #endif
    int t;cin>>t;
    while(t--){
        int n;cin>>n;
        int i;
        vector<int> v;
        for(i=1;i<=n;i++){
            v.push_back(i);
        }
        for(int i=1;i<n-1;i+=2){
            v[i]^=v[i-1]^=v[i]^=v[i-1];
        }
        v[n-1]^=v[n-2]^=v[n-1]^=v[n-2];
        cout<<v<<endl;
    }
return 0;
}

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 15:42:10
Judged At
2025-07-14 15:42:10
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB