SHARE
TWEET

maps stl

a guest Oct 14th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main() {
  2.     int q, type; cin >> q;
  3.     map<string,int> clas; string name;
  4.     for (int i(0), mark; i<q; ++i)
  5.     {
  6.         cin >> type >> name;
  7.         if (type == 1){
  8.             cin >> mark;
  9.             clas[name] += mark;
  10.         }
  11.         else if (type == 2)
  12.             clas.erase(name);
  13.         else
  14.             cout << clas[name] << "\n";
  15.     }
  16.     return 0;
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top