QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#667395 | #7894. Many Many Heads | ciyekua | WA | 0ms | 3760kb | C++23 | 1.0kb | 2024-10-22 22:44:23 | 2024-10-22 22:44:24 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#define int long long
#define pb push_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define ff first
#define ss second
#define bb begin()
#define ee end()
#define pii pair<int,int>
using namespace std;
void solve()
{
int n;cin>>n;
vi a(n+1);
for(int i=1;i<=n;i++) cin>>a[i];
int r=0,l=0;
for(int i=n;i>=1;i--) {
if(a[i]!=i) {
r=i;
break;
}
}
for(int i=1;i<=n;i++) {
if(a[i]>a[r]) {
l=i;
break;
}
}
int l1=0;
for(int i=1;i<=n;i++) {
if(a[i]!=i) {
l1=i;
break;
}
}
if(l==1) {
cout<<"1\n";
cout<<"1 "<<n<<"\n";
return ;
}
if(r==0) {
cout<<"0\n";
return ;
}
if(l1==0) {
cout<<"1\n";
cout<<"1 "<<r<<"\n";
}
else {
cout<<"2\n";
cout<<l<<" "<<r<<"\n";
cout<<1<<" "<<l<<"\n";
}
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T;cin>>T;
while(T--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3760kb
input:
6 )) ((() [()] ()[()]() ([()]) ([])([])
output:
0 0 0 0 0 0
result:
wrong output format YES or NO expected, but 0 found [1st token]