kattis

Making Sieve of Eratosthenes more memory efficient in python?

╄→гoц情女王★ 提交于 2021-02-05 05:32:28
问题 Sieve of Eratosthenes memory constraint issue Im currently trying to implement a version of the sieve of eratosthenes for a Kattis problem, however, I am running into some memory constraints that my implementation wont pass. Here is a link to the problem statement. In short the problem wants me to first return the amount of primes less or equal to n and then solve for a certain number of queries if a number i is a prime or not. There is a constraint of 50 MB memory usage as well as only using

Compare and print

若如初见. 提交于 2020-01-25 06:43:09
问题 Need help with this task. How can i Compare line two and line three where line three need to be the reverse off line two to print out succeeded? input: The first line of the input contains a single integer 1≤𝑁≤20. The two following lines each contain a string containing only the characters 0 and 1. The first of these lines represent the bits of the file before deletion and the second the bits on the same position on the hard drive after the file has been deleted. The length of these strings