We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<set>#include<map>#include<algorithm>usingnamespacestd;intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intq;cin>>q;map<string,int>mp;for(inti=0;i<q;i++){inttype;cin>>type;if(type==1){stringname;intmarks;cin>>name>>marks;mp[name]+=marks;}elseif(type==2){stringname;cin>>name;mp.erase(name);}elseif(type==3){stringname;cin>>name;cout<<mp[name]<<endl;}}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Maps-STL
You are viewing a single comment's thread. Return to all comments →