TopCoder SRM 496 DIV2
Rating: 654→892(灰)
前が酷かったので上がってもまだ灰色コーダーだけれども、大分一気に上がった。
Total: 698.3 points
250: AnagramFree
239.97 points
#include <map> #include <string> #include <vector> using namespace std; class AnagramFree { public: int getMaximumSubset(vector<string> S){ map<map<char, int>, int> m; for(int i = 0; i < S.size(); i++){ map<char, int> n; string s = S[i]; for(int j = 0; j < s.size(); j++){ n[s[j]]++; } m[n]++; } return m.size(); } };
500: ColoredSttrokes
458.33 points
#include <vector> #include <string> using namespace std; class ColoredStrokes { public: int getLeast(vector<string> picture){ int cnt = 0; /* vertical */ for(int i = 0; i < picture[0].size(); i++){ int f = 0; for(int j = 0; j < picture.size(); j++){ if(picture[j][i] == 'B' || picture[j][i] == 'G'){ if(!f) f = 1; }else{ if(f) cnt++; f = 0; } } if(f) cnt++; } /* horizontal */ for(int i = 0; i < picture.size(); i++){ int f = 0; for(int j = 0; j < picture[0].size(); j++){ if(picture[i][j] == 'R' || picture[i][j] == 'G'){ if(!f) f = 1; }else{ if(f) cnt++; f = 0; } } if(f) cnt++; } return cnt; } };