The principle of identity is that each thing is identical to itself. The ship that you have replaced all the parts of, bit by bit, over time, is no longer the same ship but not because you have replaced all its parts but because no thing is identical to what it was at any point in the past.
So, whatever you do to a thing, change it or leave it alone, it will remain identical to itself and it won't be identical to what it was at any point in the past.
The notion of an identity that would be carried over across time come what may is a fiction. Humans don't have such an identity. However, they do have the sense of their identity as a person. This sense of identity is not so different from the notion of identity whereby a thing is identical to itself. Our sense of identity tells us we are what we feel, what we remember, what we are able to do. In other words, we feel we are what we are.
Memory is normally the crucial element of our identity. We remember our name, who our family is, our friends, what we do in life, etc. Yet, suppose it was possible to replace all that we remember in one go. Suddenly, we would remember being... ourselves, because our brand new memory would just be the new ourselves. This would make no difference to our sense of identity. We would feel we know who we are. Other people would notice, of course, but only if their own memory wasn't also replaced.
The notion of identity the question is referring to is instead the notion of personal identity, whereby we are the same person as the person we were at any point in the past. Yet, we change. Our body evolves, and our mind is affected by experience of life. But we have the sense of our own identity, whereby we sense we are the person we remember being.
Mostly, it works fine. We behave as other people expect us to behave and we are not ourselves surprised at what we do, the way we do it, mostly. However, there can be mishaps. Mental illness can change us beyond recognition.
Suddenly, we no longer can do what we nonetheless clearly remember that we did routinely in the past. Or we develop an interest in something we distinctly remember we were never interested in. Other people notice, and we notice that they notice.
Yet, strictly speaking, we are still identical to ourselves because each thing is identical to itself. The problem is, our sense of identity now plays tricks on us. There is now a discrepancy between what we are now and what we remember, and what we remember still makes us feel we know who we are. But in such cases, we are no longer so sure.
So, you can replace all the atoms, or replace all the memories in one go. That won't matter. We would no care because we wouldn't even notice. Where we will notice is the less than philosophical conundrum of old age, senility and mental illness, where suddenly the fiction of our identity as a person just evaporates. Leaving us just identical to ourselves.