# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
369782 |
2021-02-22T11:57:39 Z |
sad |
Cat (info1cup19_cat) |
C++14 |
|
44 ms |
364 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;
for(int i=0;i<n/2;i++)
{
if(v[i]!=vv[i])re=0;
}
if(re==0)
{
cout<<-1<<endl;continue;
}
re=0;n/=2;
for(int i=0;i<n;i++)
{
if(v[i]==i+1)continue;
w.pb({i+1,v[i]});re++;
swap(v[i],v[v[i]-1]);
}
cout<<re<<" "<<re<<endl;
for(auto it:w)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 |
Incorrect |
44 ms |
364 KB |
Wrong answer |
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 |
Incorrect |
44 ms |
364 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
364 KB |
Wrong answer |