It might take a little experimentation, but yes. Something like this might work as a starting point:
User.find_each do |user|
untitled_topic_count = user.topics.where(title: "").count
titled_topic_count = user.topics.where.not(title: "").count
if untitled_topic_count > 0 && titled_topic_count == 0
# delete the topics and/or the user
end
end