Submission #1000613
Source Code Expand
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int get(int x,int v){return (x>>v)&1;}
int main(){
DRI(n);
int res=0;
set<int>H;
REP(i,n){
DRI(x);
res^=x;
H.insert(x^(x-1));
}
int an=0;
REP(i,30){
if((get(res,i)!=get(res,i+1))){
if(!H.count((1<<(i+1))-1))return 0*puts("-1");
an++;
}
}
printf("%d\n",an);
return 0;
}
Submission Info
Submission Time
2016-11-28 12:13:55+0900
Task
C - Cheating Nim
User
dreamoon
Language
C++14 (GCC 5.4.1)
Score
500
Code Size
1462 Byte
Status
AC
Exec Time
16 ms
Memory
256 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:32:11: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
DRI(n);
^
./Main.cpp:36:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
DRI(x);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
500 / 500
Status
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
2 ms
256 KB
001.txt
AC
2 ms
256 KB
002.txt
AC
14 ms
256 KB
003.txt
AC
8 ms
256 KB
004.txt
AC
7 ms
256 KB
005.txt
AC
6 ms
256 KB
006.txt
AC
16 ms
256 KB
007.txt
AC
16 ms
256 KB
008.txt
AC
16 ms
256 KB
009.txt
AC
16 ms
256 KB
010.txt
AC
16 ms
256 KB
011.txt
AC
16 ms
256 KB
012.txt
AC
16 ms
256 KB
013.txt
AC
16 ms
256 KB
014.txt
AC
16 ms
256 KB
015.txt
AC
16 ms
256 KB
016.txt
AC
16 ms
256 KB
017.txt
AC
16 ms
256 KB
018.txt
AC
16 ms
256 KB
019.txt
AC
16 ms
256 KB
020.txt
AC
16 ms
256 KB
021.txt
AC
3 ms
256 KB
022.txt
AC
3 ms
256 KB
023.txt
AC
14 ms
256 KB
example0.txt
AC
2 ms
256 KB
example1.txt
AC
2 ms
256 KB