比赛 |
“Asm.Def战记之拉格朗日点”杯 |
评测结果 |
AAAAAAAAAA |
题目名称 |
Asm.Def的微小贡献 |
最终得分 |
100 |
用户昵称 |
dydxh |
运行时间 |
0.176 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2015-11-04 11:48:19 |
显示代码纯文本
- /*
- Problem:cogs2092;
- Language:c++;
- by dydxh;
- 2015.11.04;
- */
- #include<iostream>
- #include<cstdio>
- #include<set>
- #include<map>
- #include<queue>
- #include<algorithm>
- #include<cstring>
- #include<cmath>
- #include<utility>
- #include<ctime>
- #include<cstdlib>
- #include<bitset>
- #include<string>
- #define ll long long
- #define ull unsigned long long
- using namespace std;
- const int oo=2000000000;
- const int maxn=1005;
- int n,ans;
- bitset<1005> A[70],Rel[70];
- bool used[maxn];
- ll a[maxn];
- inline ll read(){
- ll x=0;bool flag=0;char ch=getchar();
- while(ch>'9' || ch<'0') {if(ch=='-') flag=1;ch=getchar();}
- while(ch>='0' && ch<='9') {x=x*10+ch-'0';ch=getchar();}
- return flag?-x:x;
- }
- bool Gauss(int x){
- memcpy(A,Rel,sizeof(A));
- for(int j=1;j<=63;j++)
- if(A[j][x]){
- A[j][x]=false;
- if(A[j][n+1]==true) A[j][n+1]=false;
- else A[j][n+1]=true;
- }
- for(int j=1;j<=63;j++){
- int i=1;
- while(i<=n && A[j][i]==false) i++;
- if(i>n && A[j][n+1]==true) return false;
- else if(i<=n)
- for(int k=j+1;k<=63;k++)
- if(A[k][i]==true)
- A[k]^=A[j];
- }
- return true;
- }
- int main()
- {
- //freopen("cc.in","r",stdin);
- freopen("asm_contribute.in","r",stdin);
- freopen("asm_contribute.out","w",stdout);
- n=read();
- for(int i=1;i<=n;i++) a[i]=read();
- for(int i=1;i<=n;i++)
- for(int j=1;j<=63;j++){
- if((a[i]&(1LL<<(j-1))))
- Rel[j][i]=true;
- else Rel[j][i]=false;
- }
- for(int i=1;i<=63;i++) Rel[i][n+1]=false;
- for(int i=1;i<=n;i++)
- if(Gauss(i)){
- used[i]=true;
- ans++;
- for(int j=1;j<=63;j++)
- if(Rel[j][i]){
- Rel[j][i]=false;
- if(Rel[j][n+1]==true) Rel[j][n+1]=false;
- else Rel[j][n+1]=true;
- }
- }
- printf("%d\n",ans);
- for(int i=1;i<=n;i++)
- if(used[i])
- printf("%d ",i);
- printf("\n");
- return 0;
- }