Submission #397279

# Submission time Handle Problem Language Result Execution time Memory
397279 2021-05-01T19:32:47 Z Pichon5 Xor Sort (eJOI20_xorsort) C++17
25 / 100
1000 ms 11176 KB
#include <iostream>
#include <bits/stdc++.h>
#define vi vector<int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define vll vector<ll>
using namespace std;

int main()
{
    int x,n,s;
    cin>>n>>s;
    vi v;
    vector<pair<int,int> >E;
    for(int i=0;i<n;i++){
        cin>>x;
        v.pb(x);
    }
    for(int i=0;i<n;i++){
        for(int l=0;l<n-1;l++){
            if(v[l]>v[l+1]){
                E.pb({l+1,l+2});E.pb({l+2,l+1});E.pb({l+1,l+2});
                swap(v[l],v[l+1]);
            }
    }}
    cout<<E.size()<<endl;
    for(int i=0;i<E.size();i++){
        cout<<E[i].F<<" "<<E[i].S<<endl;
    }

    return 0;
}

Compilation message

xorsort.cpp: In function 'int main()':
xorsort.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0;i<E.size();i++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 4 ms 300 KB Output is correct
4 Correct 32 ms 624 KB Output is correct
5 Correct 35 ms 644 KB Output is correct
6 Correct 31 ms 636 KB Output is correct
7 Correct 30 ms 612 KB Output is correct
8 Correct 31 ms 648 KB Output is correct
9 Correct 34 ms 620 KB Output is correct
10 Correct 31 ms 680 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 58 ms 952 KB Output is correct
13 Correct 65 ms 880 KB Output is correct
14 Correct 63 ms 880 KB Output is correct
15 Correct 59 ms 844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 4 ms 300 KB Output is correct
4 Correct 32 ms 624 KB Output is correct
5 Correct 35 ms 644 KB Output is correct
6 Correct 31 ms 636 KB Output is correct
7 Correct 30 ms 612 KB Output is correct
8 Correct 31 ms 648 KB Output is correct
9 Correct 34 ms 620 KB Output is correct
10 Correct 31 ms 680 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 58 ms 952 KB Output is correct
13 Correct 65 ms 880 KB Output is correct
14 Correct 63 ms 880 KB Output is correct
15 Correct 59 ms 844 KB Output is correct
16 Correct 1 ms 292 KB Output is correct
17 Correct 31 ms 652 KB Output is correct
18 Correct 52 ms 896 KB Output is correct
19 Correct 56 ms 852 KB Output is correct
20 Correct 53 ms 784 KB Output is correct
21 Correct 52 ms 816 KB Output is correct
22 Correct 55 ms 768 KB Output is correct
23 Correct 56 ms 852 KB Output is correct
24 Correct 53 ms 724 KB Output is correct
25 Correct 52 ms 832 KB Output is correct
26 Incorrect 113 ms 1172 KB Integer 59568 violates the range [0, 40000]
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 59 ms 856 KB Output is correct
5 Execution timed out 1081 ms 11176 KB Time limit exceeded
6 Halted 0 ms 0 KB -