/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 2ms 576.0 KiB

Code

#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(nullptr);



void solve() {
       
     
      int n ;
      cin >> n ;
      int i = 1 ;
      while(n > 3) {
        cout << i + 1 << " " << i << " " ;
        i += 2 ;
        n -= 2 ;
      }
      assert(n == 2 || n == 3) ;
      if(n == 2) {
        cout << i + 1 << " " <<i << " " ;
        cout << endl ;
      } else {
        cout << i + 1 << " " << i + 2 << " " << i  ;
        cout << endl ;
      }
}









int32_t main() {

    fastio();
    int t = 1;
    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:14:18
Judged At
2025-07-14 17:14:18
Judged By
Score
100
Total Time
2ms
Peak Memory
576.0 KiB