提出 #18665


ソースコード 拡げる

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;
}

提出情報

提出日時
問題 B - さかさま辞書
ユーザ yakk512
言語 C++ (G++ 4.6.4)
得点 0
コード長 732 Byte
結果 CE

コンパイルエラー

./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