No, you didn't. As AKRBTN noted, your iCloud account got hacked, not your iPad. Typically, this is because of a weak password that was easily guessed or broken.
There are NO VIRUSES on iOS devices. A virus is a specific type of malware. The distinguishing feature is they self replicate by infecting other devices it can directly see, and then copy itself to. These do not exist in iOS. There has yet to be one in the Mac OS, either. Unix, which the Mac OS sits on top of, is extremely good at blocking this type of infection because of its purposely built design of permissions. A virus is almost impossible on either system because they can't write themselves wherever they want on a drive. The OS doesn't allow it.
MS has only very recently started trying to make Windows more like Unix. But it is still a huge, gaping Swiss Cheese security design. That is mostly due to large corporate users who insist that newer versions of Windows do not break decades old company proprietary software. In order for that software to function, the OS needs to be as virtually wide open to apps writing data anywhere they want as it was 20-30 years ago. MS needs to just tell these companies, TOUGH! We're locking the OS down. Update your ancient apps.