Degree of an algebraic number

  • + 1 comment

    I really liked this one! Since no one has commented anything here, thought I'd give a few hints out: 1. Yes, you do need to factor pretty much every number you're given. However, if you're only given one number (N = 1), you only need check whether or not the given number is a square. This actually was holding me up on the last test case. 2. If you've got some matrix you want to row reduce modulo 2, you're on the right track. Gauss Jordan works, just make sure you do it efficiently. That was probably my biggest problem; my code wasn't the most efficient so it just kept timing out.

    I did this in Python 3, but man, even with the right ideas (I checked the editorial after I got it and I had the same process), it was just hard to get past TLE.