/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Runtime Error Fatal glibc error: malloc.c:2599 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0) 5ms 440.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;


int main(){
    int x, T;

    cin >> T;

    for(int i = 0; i < T; i++){
        cin >> x;

        vector<int>arr(x);


        if(x % 2 == 0){
            for(int i = 0 ; i < x; i++){
                arr[i] = i + 2;
                arr[i+1] = i + 1;
                i = i+1;
            }
        }
        else{
            for(int i = 0; i < x; i++){
                arr[i] = i + 2;
                arr[i + 1] = i + 3;
                arr[i + 2] = i + 1;
                i += 2;
            }
        }

        for(auto a: arr){
            cout << a << " ";
        }
        cout << endl;

        arr.clear();

    }
}

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 16:37:10
Judged At
2025-07-14 16:37:10
Judged By
Score
0
Total Time
5ms
Peak Memory
532.0 KiB