Submission #18665
Source Code Expand
Copy
#include <cstdio> #include <string> #include <algorithm> #include <numeric> #include <map> using namespace::std; class ComP { public: bool operator()(const string Left, const string Right) const { int i = 0; while(Left[i] == Right[i])i++; return Left[i] < Right[i]; } }; int main(void){ vector<string> s; int N; map<string,string>m; cin >> N; for(int i = 0; i < N; i++) { string temp; cin >> temp; string temp2=temp; reverse(temp.begin(),temp.end()); s.push_back(temp); m[temp] = temp2; } sort(s.begin(),s.end(),ComP()); for(int i = 0; i < N; i++) cout << m[s[i]] <<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - さかさま辞書 |
User | yakk512 |
Language | C++ (G++ 4.6.4) |
Score | 0 |
Code Size | 732 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:3: error: ‘vector’ was not declared in this scope ./Main.cpp:23:16: error: expected primary-expression before ‘>’ token ./Main.cpp:23:18: error: ‘s’ was not declared in this scope ./Main.cpp:26:3: error: ‘cin’ was not declared in this scope ./Main.cpp:41:5: error: ‘cout’ was not declared in this scope ./Main.cpp:41:23: error: ‘endl’ was not declared in this scope