Submission #2326800
Source Code Expand
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Runtime.Remoting.Contexts; using System.Security.Cryptography.X509Certificates; namespace Contest { class Scanner { private string[] line = new string[0]; private int index = 0; public string Next() { if (line.Length <= index) { line = Console.ReadLine().Split(' '); index = 0; } var res = line[index]; index++; return res; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public string[] Array() { line = Console.ReadLine().Split(' '); index = line.Length; return line; } public int[] IntArray() { var array = Array(); var result = new int[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = int.Parse(array[i]); } return result; } public long[] LongArray() { var array = Array(); var result = new long[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = long.Parse(array[i]); } return result; } } class Program { private int N; private long[] A; private void Scan() { var sc = new Scanner(); N = sc.NextInt(); A = new long[N]; for (int i = 0; i < N; i++) { A[i] = sc.NextLong(); } } public void Solve() { Scan(); long x = 0; foreach (long i in A) { x ^= i; } int cnt = 0; for (int i = 29; i >= 0; i--) { foreach (var i1 in A) { var u = i1 ^ (i1 - 1); if ((x & ((u + 1) >> 1)) > 0) { x ^= u; cnt++; break; } } } Console.WriteLine(x == 0 ? cnt : -1); } static void Main(string[] args) { new Program().Solve(); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Cheating Nim |
User | mban |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 2748 Byte |
Status | WA |
Exec Time | 84 ms |
Memory | 15824 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 23 ms | 11220 KB |
001.txt | AC | 21 ms | 11092 KB |
002.txt | AC | 84 ms | 15824 KB |
003.txt | WA | 48 ms | 15456 KB |
004.txt | AC | 44 ms | 15328 KB |
005.txt | AC | 39 ms | 15200 KB |
006.txt | WA | 74 ms | 15824 KB |
007.txt | WA | 80 ms | 13776 KB |
008.txt | WA | 81 ms | 13776 KB |
009.txt | WA | 77 ms | 15824 KB |
010.txt | WA | 74 ms | 15824 KB |
011.txt | WA | 81 ms | 15824 KB |
012.txt | WA | 81 ms | 15824 KB |
013.txt | WA | 75 ms | 15824 KB |
014.txt | WA | 81 ms | 15824 KB |
015.txt | WA | 74 ms | 13780 KB |
016.txt | AC | 74 ms | 13776 KB |
017.txt | AC | 75 ms | 13776 KB |
018.txt | WA | 74 ms | 15824 KB |
019.txt | WA | 77 ms | 15824 KB |
020.txt | AC | 76 ms | 13776 KB |
021.txt | AC | 26 ms | 9092 KB |
022.txt | AC | 26 ms | 11136 KB |
023.txt | AC | 81 ms | 13776 KB |
example0.txt | AC | 20 ms | 9044 KB |
example1.txt | AC | 20 ms | 9172 KB |