Submission #1632763


Source Code Expand

#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define lb(x) ((x)&(-(x)))
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define pii pair<int,int> 
#define dalao 1000000007
#define inf 0x3f3f3f3f
#define N 305
using namespace std;
typedef long long ll;
int n,a[N],s,ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),s^=a[i];
	for(int i=29;~i;i--)if(s>>i&1)
		for(int j=1;j<=n;j++)if(lb(a[j])==1<<i){ans++,s^=(1<<i+1)-1;break;}
	if(s)puts("-1");else cout<<ans;
	return 0;
}

Submission Info

Submission Time
Task C - Cheating Nim
User cdsfcesf
Language C++14 (GCC 5.4.1)
Score 0
Code Size 604 Byte
Status RE
Exec Time 106 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
./Main.cpp:18:48: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++)scanf("%d",&a[i]),s^=a[i];
                                                ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 4
WA × 1
RE × 21
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 1 ms 256 KB
001.txt AC 1 ms 256 KB
002.txt RE 106 ms 256 KB
003.txt WA 1 ms 256 KB
004.txt RE 103 ms 256 KB
005.txt RE 104 ms 256 KB
006.txt RE 105 ms 256 KB
007.txt RE 103 ms 256 KB
008.txt RE 102 ms 256 KB
009.txt RE 106 ms 256 KB
010.txt RE 102 ms 256 KB
011.txt RE 102 ms 256 KB
012.txt RE 105 ms 256 KB
013.txt RE 104 ms 256 KB
014.txt RE 106 ms 256 KB
015.txt RE 102 ms 256 KB
016.txt RE 103 ms 256 KB
017.txt RE 106 ms 256 KB
018.txt RE 103 ms 256 KB
019.txt RE 106 ms 256 KB
020.txt RE 105 ms 256 KB
021.txt RE 102 ms 256 KB
022.txt RE 106 ms 256 KB
023.txt RE 106 ms 256 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB