結果

問題 No.2715 Unique Chimatagram
ユーザー kekenx
提出日時 2024-05-26 17:06:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 85,432 KB
最終ジャッジ日時 2025-02-21 16:47:39
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cassert>
#include <algorithm>
#include <map>

using namespace std;

int main() {
  int N; cin >> N;
  map<string, int> mp;
  for (int i = 0; i < N; i++) {
    string S; cin >> S;
    sort(S.begin(), S.end());
    mp[S]++;
  }

  string lng = "";
  for (auto [s, cnt]: mp) {
    if (cnt == 1 && s.size() > lng.size()) {
      lng = s;
    }
  }

  cout << (lng.size() > 0? "a" + lng: "-1") << endl;
  return 0;
}
  

0