Fast and memory-efficient exact attention