Submission #370816

# Submission time Handle Problem Language Result Execution time Memory
370816 2021-02-24T17:12:06 Z sad Cat (info1cup19_cat) C++14
0 / 100
12 ms 492 KB
    #include <bits/stdc++.h>
    #define pb push_back
    #define ll long long
    #define fi first
    #define se second
    using namespace std;
    vector<int>v,vv;int n;
    vector<pair<int,int>>w;
    int main()
    {
        int t;cin>>t;
        while(t--)
        {
            cin>>n;v.clear();vv.clear();
            for(int i=0;i<n/2;i++)
            {
                int x;cin>>x;
                v.pb(x);
            }
            for(int i=0;i<n/2;i++)
            {
                int x;cin>>x;
                x-=n/2;
                vv.pb(x);
            }int re=1;
            re=0;n/=2;
            for(int i=0;i<n;i++)
            {
                for(int j=i+1;j<n;j++)
                {
                    if(v[i]==j+1)
                    {
                        re++;
                        w.pb({i+1,j+1});
                        swap(v[i],v[j]);
                        swap(vv[n-i+1],vv[n-1+j]);break;
                    }
                }
            }
            for(int i=1;i<n;i++)if(vv[i]<vv[i-1])re=-1;
            if(re==-1)
            {
                cout<<-1<<endl;w.clear();continue;
            }
            cout<<0<<" "<<w.size()<<endl;
            for(auto it:w)
            if(it.fi==it.se)continue;
            else cout<<it.fi<<" "<<it.se<<endl;
            w.clear();
        }
    }
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 364 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 364 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 364 KB Wrong answer