You are viewing a single comment's thread. Return to all comments →
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int t; cin>>t; mapmp; while(t--){ int a; cin>>a; string s; cin>>s; if(a==1){ int marks; cin>>marks; auto it=mp.find(s); if(it!=mp.end()){ mp[s]+=marks; }else{ mp.insert(make_pair(s,marks)); } } if(a==2){ mp.erase(s); } if(a==3){ if(mp.find(s)!=mp.end()){ cout<
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 →
include
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
int t; cin>>t; mapmp; while(t--){ int a; cin>>a; string s; cin>>s; if(a==1){ int marks; cin>>marks; auto it=mp.find(s); if(it!=mp.end()){ mp[s]+=marks; }else{ mp.insert(make_pair(s,marks)); } } if(a==2){ mp.erase(s); } if(a==3){ if(mp.find(s)!=mp.end()){ cout<