generated from arol-polito/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
day 17 part 2 solution, input specific but runs in some microseconds
- Loading branch information
Showing
4 changed files
with
160 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Register A: 35200350 | ||
Register A: 37221274271220 | ||
Register B: 0 | ||
Register C: 0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
2,4 1,2 7,5 4,7 1,3 5,5 0,3 3,0 | ||
|
||
primo giro: | ||
|
||
b = a & 111 | ||
b = b ^ 010 | ||
c = a >> b | ||
b = b ^ c | ||
b = b ^ 011 | ||
(b & 111) == 2 | ||
|
||
b = (a & 111) ^ 010 | ||
c = a >> ((a & 111) ^ 010) | ||
b = ((a & 111) ^ 010) ^ (a >> ((a & 111) ^ 010)) | ||
b = ((a & 111) ^ 010) ^ (a >> ((a & 111) ^ 010)) ^ 011 | ||
print(b & 111) => (((a & 111) ^ 010) ^ (a >> ((a & 111) ^ 010)) ^ 011) & 111 = 010 | ||
=> (x ^ (a >> x) ^ 011) & 111 = 010 | ||
=> x ^ (a >> x) ^ 011 = 010 | ||
=> x ^ (a >> x) = 001 | ||
|
||
secondo giro: | ||
|
||
if a >> 3 != 0 (cioe' a >= 8) { | ||
((((a >> 3)& 111) ^ 010) ^ ((a >> 3)>> (((a >> 3)& 111) ^ 010)) ^ 011) & 111 = 100 | ||
} else (cioe' a < 8) { | ||
break | ||
quindi, al secondo giro a >= 8 sicuramente | ||
} | ||
|
||
terzo giro: | ||
if a >> 6 != 0 (cioe' a >= 64) { | ||
((((a >> 6)& 111) ^ 010) ^ ((a >> 6)>> (((a >> 6)& 111) ^ 010)) ^ 011) & 111 = 001 | ||
} else { | ||
break | ||
quindi, anche ora al terzo giro >= 64 sicuramente | ||
} | ||
|
||
sicuramente a >= 2^15, inoltre posso mettere tante condizioni a sistema: | ||
(((a & 111) ^ 010) ^ (a >> ((a & 111) ^ 010)) ^ 011) & 111 = 010 | ||
((((a >> 3)& 111) ^ 010) ^ ((a >> 3)>> (((a >> 3)& 111) ^ 010)) ^ 011) & 111 = 100 | ||
((((a >> 6)& 111) ^ 010) ^ ((a >> 6)>> (((a >> 6)& 111) ^ 010)) ^ 011) & 111 = 001 | ||
((((a >> 9)& 111) ^ 010) ^ ((a >> 9)>> (((a >> 9)& 111) ^ 010)) ^ 011) & 111 = 010 | ||
((((a >> 12)& 111) ^ 010) ^ ((a >> 12)>> (((a >> 12)& 111) ^ 010)) ^ 011) & 111 = 111 | ||
((((a >> 15)& 111) ^ 010) ^ ((a >> 15)>> (((a >> 15)& 111) ^ 010)) ^ 011) & 111 = 101 | ||
((((a >> 18)& 111) ^ 010) ^ ((a >> 18)>> (((a >> 18)& 111) ^ 010)) ^ 011) & 111 = 100 | ||
((((a >> 21)& 111) ^ 010) ^ ((a >> 21)>> (((a >> 21)& 111) ^ 010)) ^ 011) & 111 = 111 | ||
((((a >> 24)& 111) ^ 010) ^ ((a >> 24)>> (((a >> 24)& 111) ^ 010)) ^ 011) & 111 = 001 | ||
((((a >> 27)& 111) ^ 010) ^ ((a >> 27)>> (((a >> 27)& 111) ^ 010)) ^ 011) & 111 = 011 | ||
((((a >> 30)& 111) ^ 010) ^ ((a >> 30)>> (((a >> 30)& 111) ^ 010)) ^ 011) & 111 = 101 | ||
((((a >> 33)& 111) ^ 010) ^ ((a >> 33)>> (((a >> 33)& 111) ^ 010)) ^ 011) & 111 = 101 | ||
((((a >> 36)& 111) ^ 010) ^ ((a >> 36)>> (((a >> 36)& 111) ^ 010)) ^ 011) & 111 = 000 | ||
((((a >> 39)& 111) ^ 010) ^ ((a >> 39)>> (((a >> 39)& 111) ^ 010)) ^ 011) & 111 = 011 | ||
((((a >> 42)& 111) ^ 010) ^ ((a >> 42)>> (((a >> 42)& 111) ^ 010)) ^ 011) & 111 = 011 | ||
((((a >> 45)& 111) ^ 010) ^ ((a >> 45)>> (((a >> 45)& 111) ^ 010)) ^ 011) & 111 = 000 | ||
|
||
a >= 2^45 | ||
|
||
((x ^ 010) ^ (x >> (x ^ 010)) ^ 011) & 111 = 100 | ||
|
||
(((b ^ 010) ^ ((a >> 3)>> ((b ^ 010)) ^ 011) & 111 = 100 | ||
(((b ^ 010) ^ ((a >> (3 + (b ^ 010))) ^ 011) & 111 = 100 | ||
(((x ^ 010) ^ ((a >> i)>> (x ^ 010) ^ 011) & 111 = 100 |