You are viewing a single comment's thread. Return to all comments →
#include <iostream> #include <map> #include <algorithm> #include<assert.h> int main() { std::map<std::string,int>sheet{}; int queries{}; std::cin>>queries; assert(queries>=1 && queries<=1000000); for(int i=0;i<queries;++i) { int q{}; std::string name{}; std::cin>>q; assert(q>=1&&q<=3); std::cin>>name; assert(name.size()>=1 &&name.size()<=6); if(q==1){int marks{};std::cin>>marks;sheet[name]+=marks;} else if(q==2)sheet[name]=0; else if(q==3)std::cout<<sheet[name]<<"\n"; } return 0; }
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 →