A Memory-efficient Python Implementation Needed

Revision en1, by beginner1010, 2019-09-01 03:56:25

Hello,

I have recently started learning Python. I tried F. Vus the Cossack and a Graph from Codeforces Round #571 (Div. 2). To solve this problem, first I wrote a recursive function to find an Euler circuit, and I got MLE (Memory Limit Exceeded). Using an iterative method (with stack) did not help me either.

You may find the Python implementation here in 59832390

I would appreciate if you give me some hints to make the implementation more efficient in terms of memory. Of course, any hint to make it faster is welcomed.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English beginner1010 2019-09-01 03:56:25 692 Initial revision (published)