Yes the contract functions and permissions can be defined by the programmer. Every interaction with a contract costs RC (gas) and for storing/updating/reading big data this RC costs can be pretty high. What you have in mind is definitely possible, needs aggregation outside of the contract to save gas but will still be very gas expensive. We could make a POC if you have a community/project that will use it. Do you have one in mind? If we know what they need we could figure things out!
RE: New Year Lottery on Magi - Where EVERYONE WINS | Ōkinoko Takara