Submission #2865203
Source Code Expand
N = gets.to_i as = N.times.map{gets.to_i} ones = {} as.each do |a| num = 0 num += 1 while a % (2<<num) == 0 ones[a] = num end as.sort_by!{|a| -ones[a]} pt = 0 L = as.max.bit_length ans = 0 (L-1).downto(0) do |i| bit = 0 as.each do |a| bit ^= a[i] end if bit == 1 while pt < N && ones[as[pt]] > i pt += 1 end if pt < N && ones[as[pt]] == i as[pt] -= 1 pt += 1 ans += 1 else puts -1 exit end end end puts ans
Submission Info
Submission Time | |
---|---|
Task | C - Cheating Nim |
User | betrue12 |
Language | Ruby (2.3.3) |
Score | 500 |
Code Size | 589 Byte |
Status | AC |
Exec Time | 552 ms |
Memory | 10312 KB |
Compile Error
./Main.rb:27: warning: ambiguous first argument; put parentheses or a space even after `-' operator
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 | 7 ms | 1788 KB |
001.txt | AC | 7 ms | 1788 KB |
002.txt | AC | 423 ms | 5368 KB |
003.txt | AC | 148 ms | 4344 KB |
004.txt | AC | 91 ms | 6776 KB |
005.txt | AC | 57 ms | 4984 KB |
006.txt | AC | 539 ms | 9648 KB |
007.txt | AC | 511 ms | 9720 KB |
008.txt | AC | 516 ms | 9648 KB |
009.txt | AC | 534 ms | 9648 KB |
010.txt | AC | 515 ms | 9648 KB |
011.txt | AC | 519 ms | 9648 KB |
012.txt | AC | 533 ms | 9648 KB |
013.txt | AC | 523 ms | 9648 KB |
014.txt | AC | 552 ms | 9648 KB |
015.txt | AC | 544 ms | 9648 KB |
016.txt | AC | 512 ms | 9520 KB |
017.txt | AC | 406 ms | 10312 KB |
018.txt | AC | 513 ms | 9976 KB |
019.txt | AC | 549 ms | 9520 KB |
020.txt | AC | 480 ms | 9592 KB |
021.txt | AC | 33 ms | 2808 KB |
022.txt | AC | 32 ms | 2808 KB |
023.txt | AC | 297 ms | 5368 KB |
example0.txt | AC | 7 ms | 1788 KB |
example1.txt | AC | 7 ms | 1788 KB |