Submission #465731

# Submission time Handle Problem Language Result Execution time Memory
465731 2021-08-16T17:19:40 Z idas Xor Sort (eJOI20_xorsort) C++11
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define PB push_back
#define F first
#define S second

const int INF=1e9;
const long long LINF=1e18;

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef map<int, int> mii;

const int N=210;
int n, a[N], s;
vector<pii> ans;

int main()
{
    FAST_IO;
    cin >> n >> s;
    FOR(i, 0, n) cin >> a[i];

    bool going=true;
    while(going){
        going=false;
        FOR(i, 1, n)
        {
            if(a[i-1]>a[i]){
                swap(a[i-1], a[i]);
                ans.PB({i, i+1});
                ans.PB({i+1, i});
                ans.PB({i, i+1});
                going=true;
            }
        }
    }

    /*cout << ans.size() << '\n';
    for(auto[x, y] : ans){
        cout << x << " " << y << '\n';
    }*/

    FOR(i, 0, n) cout << a[i] << " ";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 176425 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Integer 176425 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Integer 321675 violates the range [1, 5]
2 Halted 0 ms 0 KB -