POJ 3669 submit(Memory Limit Exceeded)