QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#748512 | #5521. Excellent XOR Problem | ucup-team2179# | WA | 1ms | 3600kb | C++23 | 2.0kb | 2024-11-14 20:36:18 | 2024-11-14 20:36:18 |
Judging History
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 << "\n";
return;
}
if(a[n]!=f(1,n-1)){
cout<<"YES\n2\n";
cout << 1 << " " << n - 1 << "\n";
cout << n << " " << 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个字符)的部分作为字符串的初值
/*
*/
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3600kb
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)