QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#667395#7894. Many Many HeadsciyekuaWA 0ms3760kbC++231.0kb2024-10-22 22:44:232024-10-22 22:44:24

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 22:44:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3760kb
  • [2024-10-22 22:44:23]
  • 提交

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]