結果

問題 No.8042 本棚
ユーザー beet
提出日時 2019-04-03 20:03:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 885 bytes
コンパイル時間 2,281 ms
コンパイル使用メモリ 215,600 KB
最終ジャッジ日時 2025-01-07 01:22:52
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T>
vector<T> compress(vector<T> v){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  return v;
}

template<typename T>
map<T, int> dict(const vector<T> &v){
  map<T, int> res;
  for(int i=0;i<(int)v.size();i++)
    res[v[i]]=i;
  return res;
}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;

  vector<string> vs({"iti","ni","san","yon"});
  auto dc=dict(vs);
  
  using P = pair<string, int>;
  vector<P> vp;
  for(int i=0;i<n;i++){
    string s,t;
    cin>>s>>t;
    vp.emplace_back(s,dc[t]);
  }
  sort(vp.begin(),vp.end());
  
  for(auto p:vp)
    cout<<p.first<<" "<<vs[p.second]<<endl;  
  return 0;
}
0