PKU 2503 Babelfish
問題としてはクソ簡単なのですが時間制限がキツい。
map
#include <string> #include <sstream> #include <iostream> #include <map> using namespace std; map<string,string> ma; int main() { string s; while(1) { string key,value; getline(cin,s); if(s.size()<2)break; stringstream ss(s); ss >> value >> key; ma[key]=value; } while(1) { string key; if(!(cin >> key))break; if(ma.find(key)==ma.end())printf("eh\n"); else cout << ma[key] << endl; } return 0; }
なお、G++では通りません。C++でのみ通るようです。
構造体を作ってソートしてにぶたんしても間に合うらしい。
闇。