# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
777174 |
2023-07-08T18:37:47 Z |
HD1 |
Cat (info1cup19_cat) |
C++14 |
|
301 ms |
28952 KB |
//we are all lost trying to be someone.
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define sz(x) ll(x.size())
#define reve(x) reverse(x.begin(),x.end())
#define ff first
#define ss second
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<ll, ii >tri;
const ll MAX=1e5+100;
const ll mod=1e9+7;
const ll inf=1e9;
ll A[MAX], pos[MAX];
vector<ii> ans;
ll n;
bool sepuede(){
ll sum=n+1;
for(ll i=1; i<=n/2; i++){
if(A[i]+A[sum-i]!=sum) return false;
}
return true;
}
void solve(){
cin>>n;
for(ll i=1; i<=n; i++){
cin>>A[i];
}
if(!sepuede()){
cout<<-1<<'\n';
return;
}
for(ll i=1; i<=n/2; i++){
pos[A[i]]=i;
}
ll cont=0;
for(ll i=1; i<=n/2; i++){
if(A[i]!=i){
ll a=pos[i];
ll b=A[i];
ans.pb({a,i});
swap(A[pos[i]],A[i]);
pos[i]=i;
pos[b]=a;
cont++;
}
}
/*
for(ll i=1; i<=n/2; i++){
cout<<A[i]<<" ";
}
cout<<'\n';*/
cout<<sz(ans)<<" "<<sz(ans)<<'\n';
for(ii x:ans){
cout<<x.ff<<" "<<x.ss<<'\n';
}
ans.clear();
return;
}
int main(){
fastio;
ll t;
cin>>t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
340 KB |
Integer parameter [name=x] equals to 0, violates the range [1, 8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
980 KB |
Output is correct |
2 |
Correct |
20 ms |
1028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
340 KB |
Integer parameter [name=x] equals to 0, violates the range [1, 8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
980 KB |
Output is correct |
2 |
Correct |
20 ms |
1028 KB |
Output is correct |
3 |
Correct |
301 ms |
28952 KB |
Output is correct |
4 |
Runtime error |
9 ms |
2776 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
340 KB |
Integer parameter [name=x] equals to 0, violates the range [1, 8] |
2 |
Halted |
0 ms |
0 KB |
- |