QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748538#5521. Excellent XOR Problemucup-team2179#WA 0ms3492kbC++232.0kb2024-11-14 20:39:302024-11-14 20:39:30

Judging History

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

  • [2024-11-14 20:39:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3492kb
  • [2024-11-14 20:39:30]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define pb push_back
bool debug=1;

#define dbg(x) if(debug)cerr <<  #x <<  " = " << (x) <<endl
using namespace std;void ass(string err){cout<<err<<"\n";exit(0);}void ass(int err){cout<<err<<"\n";exit(0);}
typedef pair < long double,long double> pii;
const string COLOR_RESET = "\033[0m",  BRIGHT_CYAN = "\033[1;36m", NORMAL_FAINT = "\033[0;2m";
const int M = 998244353;
int fp(int a,int b)
{
	int re=1;
	while(b)
	{
		if(b&1)re*=a;
		a*=a; re%=M;a%=M;
		b=b>>1;
	}
	return re;
}
int div(int a){
	return fp(a, M - 2);
}

void solve()
{
	ios::sync_with_stdio(false);cin.tie(0);mt19937_64 engie(202202052100238523);
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 1; i <= n;i++){
		cin >> a[i];
	}
	auto f = [&](int l, int r)
	{
		int ans = a[l];
		for (int i = l; i <= r;i++)
			ans |= a[i];
		return ans;
	};
	if(a[1]!=f(2,n)){
		cout<<"YES\n2\n";
		cout << "1 1\n2 " << n;
		return;
	}
	if(a[n]!=f(1,n-1)){
		cout<<"YES\n2\n";
		cout << 1 << " " << n - 1 << "\n";
		cout << n << " " << n;
		return;
	}
	cout << "NO";
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	int t=1;
	cin>>t;
	while(t--)
	{
		solve();
		cout << "\n";
	}
	return 0;
}

//__builtin_popcountl( ) 计算二进制1个数
//cout<<fixed<<setprecision(2);输出小数,四舍六入五取偶 
//__builtin_ctz( )返回末尾0的个数
//__builtin_clz( ) 返回前导0的个数
//__builtin_parity( )返回1的个数的奇偶性,偶数返回0
//__builtin_ffs( )返回最后一个1在第几位
//__builtin_sqrt( )快速开平方 
//stoll()字符串转为长整形
//点(x,y)的极角atan2(y,x)
//点(x,y)逆时针旋转A度,(x*cosA-y*sinA ,  x*sinA+y*cosA ) 
//C(n,k)+C(n,k-1)=(n+1,k)
//string s(str,stridx,strlen) //将字符串str内“始于stridx且长度顶多strlen”
//(从stridx开始往后strlen个字符)的部分作为字符串的初值
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3492kb

input:

4
2
0 0
3
1 2 3
5
16 8 4 2 1
6
42 42 42 42 42 42

output:

NO
YES
2
1 1
2 3
YES
2
1 1
2 5
NO

result:

FAIL all xors must be different (test case 2)