提出 #66387561
ソースコード 拡げる
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using pl = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using mint=modint998244353;
int main(){
ll t;
cin>>t;
rep(aa,0,t){
ll n,k;
cin>>n>>k;
vector<ll> f(n);
rep(i,0,n){
cin>>f[i];
}
vvl z(60,vl(n+1));
f.push_back(k);
rep(i,0,n+1){
rep(j,0,60){
if(((ll)1<<j)&f[i])z[j][i]=1;
}
}
ll now=0;
ll cc=0;
rep(i,0,60){
while(now<n+1){
ll d=1;
rep(j,i,60){
if(z[j][now]==1){
swap(z[i],z[j]);
d=0;
break;
}
}
if(d==0)break;
else now++;
}
if(now==n+1)break;
if(now==n){
cc=1;
break;
}
rep(j,0,60){
if(i!=j&&z[j][now]==1){
rep(k,0,n+1)z[j][k]=z[j][k]^z[i][k];
}
}
now++;
}
if(cc==1){
cout<<"No"<<endl;
continue;
}
vl d(n);
now=0;
rep(i,0,n){
if(now<60&&z[now][i]==1){
if(z[now][n]==1){
d[i]=1;
}
now++;
}
}
ll ff=0;
rep(i,0,n-1){
if(d[i]==d[i+1])ff=1;
}
if(ff==0){
rep(i,0,n){
if(z[i][i]==0){
d[i]=1-d[i];
rep(j,0,i){
if(z[j][i]==1)d[j]=1-d[j];
}
break;
}
}
}
ff=0;
rep(i,0,n-1){
if(d[i]==d[i+1])ff=1;
}
if(ff==0){
cout<<"No"<<endl;
continue;
}
cout<<"Yes"<<endl;
ll g=0;
vl ans;
rep(i,0,n-1){
if(d[i]==d[i+1])ff=i;
}
if(d[ff]==1){
ans.push_back(ff);
rep(i,ff+2,n){
if((i+ff)%2==0){
rep(j,ff+1,i){
ans.push_back(j);
ans.push_back(j);
}
}
else{
rep(k,ff,i){
ll j=(i-1)+ff-k;
ans.push_back(j);
}
}
}
}
else{
ans.push_back(ff);
ans.push_back(ff);
rep(i,ff+2,n){
if((i+ff)%2==1){
rep(j,ff+1,i){
ans.push_back(j);
ans.push_back(j);
}
}
else{
rep(k,ff,i){
ll j=(i-1)+ff-k;
ans.push_back(j);
}
}
}
}
if(ans[ans.size()-1]!=ff)ans.push_back(ff);
rep(ii,0,ff){
ll i=ff-1-ii;
if(d[i]==1){
ans.push_back(i);
}
else{
ans.push_back(i);
ans.push_back(i+1);
ans.push_back(i);
}
}
cout<<ans.size()<<endl;
rep(i,0,ans.size())cout<<ans[i]+1<<" ";
cout<<endl;
}
}
提出情報
コンパイルエラー
Main.cpp: In function ‘int main()’:
Main.cpp:5:41: warning: comparison of integer expressions of different signedness: ‘ll’ {aka ‘long long int’} and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
5 | #define rep(i, l, r) for (ll i = (l); i < (r); ++i)
| ^
Main.cpp:152:9: note: in expansion of macro ‘rep’
152 | rep(i,0,ans.size())cout<<ans[i]+1<<" ";
| ^~~
Main.cpp:99:12: warning: unused variable ‘g’ [-Wunused-variable]
99 | ll g=0;
| ^
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
800 / 800 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
00_sample_00.txt |
| All |
00_sample_00.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 00_sample_00.txt |
AC |
1 ms |
3484 KiB |
| 01_test_00.txt |
AC |
2 ms |
3704 KiB |
| 01_test_01.txt |
AC |
2 ms |
3568 KiB |
| 01_test_02.txt |
AC |
4 ms |
3772 KiB |
| 01_test_03.txt |
AC |
4 ms |
3644 KiB |
| 01_test_04.txt |
AC |
6 ms |
3648 KiB |
| 01_test_05.txt |
AC |
6 ms |
3592 KiB |
| 01_test_06.txt |
AC |
7 ms |
3648 KiB |
| 01_test_07.txt |
AC |
6 ms |
3584 KiB |
| 01_test_08.txt |
AC |
2 ms |
3624 KiB |
| 01_test_09.txt |
AC |
6 ms |
3668 KiB |
| 01_test_10.txt |
AC |
9 ms |
3640 KiB |
| 01_test_11.txt |
AC |
9 ms |
3780 KiB |
| 01_test_12.txt |
AC |
10 ms |
3640 KiB |
| 01_test_13.txt |
AC |
2 ms |
3692 KiB |
| 01_test_14.txt |
AC |
5 ms |
3700 KiB |
| 01_test_15.txt |
AC |
5 ms |
3772 KiB |
| 01_test_16.txt |
AC |
7 ms |
3572 KiB |
| 01_test_17.txt |
AC |
7 ms |
3544 KiB |
| 01_test_18.txt |
AC |
7 ms |
3748 KiB |
| 01_test_19.txt |
AC |
7 ms |
3584 KiB |
| 01_test_20.txt |
AC |
4 ms |
3704 KiB |
| 01_test_21.txt |
AC |
4 ms |
3648 KiB |
| 01_test_22.txt |
AC |
7 ms |
3636 KiB |
| 01_test_23.txt |
AC |
7 ms |
3600 KiB |
| 01_test_24.txt |
AC |
2 ms |
3608 KiB |
| 01_test_25.txt |
AC |
2 ms |
3564 KiB |
| 01_test_26.txt |
AC |
2 ms |
3604 KiB |
| 01_test_27.txt |
AC |
2 ms |
3564 KiB |
| 01_test_28.txt |
AC |
2 ms |
3556 KiB |
| 01_test_29.txt |
AC |
3 ms |
3708 KiB |
| 01_test_30.txt |
AC |
5 ms |
3592 KiB |
| 01_test_31.txt |
AC |
3 ms |
3668 KiB |
| 01_test_32.txt |
AC |
8 ms |
3808 KiB |