/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 320.0 KiB

Code

// Author: Mushfiq R.
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define vsort(v) sort(v.begin(), v.end())
#define rsort(v) sort(v.begin(), v.end(), greater<int>())
#define fastIO (ios_base::sync_with_stdio(false), cin.tie(NULL));
using namespace std;

int main()
{
    fastIO;
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        string ans = "";

        if (n % 2 == 1)
        {
            for (int i = 2; i <= n; i += 2)
            {
                ans += to_string(i) + " ";
            }
            for (int i = n; i >= 1; i -= 2)
            {
                ans += to_string(i) + " ";
            }
        }
        else
        {
            for (int i = 1; i <= n; i += 2)
            {
                ans += to_string(i + 1) + " " + to_string(i) + " ";
            }
        }

        cout << ans << 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:52:29
Judged At
2025-07-14 15:52:29
Judged By
Score
0
Total Time
1ms
Peak Memory
532.0 KiB