結果
| 問題 | No.2715 Unique Chimatagram |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-05 21:32:27 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 1,075 bytes |
| 記録 | |
| コンパイル時間 | 1,377 ms |
| コンパイル使用メモリ | 221,380 KB |
| 実行使用メモリ | 11,972 KB |
| 最終ジャッジ日時 | 2026-07-04 09:59:45 |
| 合計ジャッジ時間 | 3,048 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#if __cplusplus < 202002L
template <class T> int ssize(const T& a){ return a.size(); }
#endif
template <class T1, class T2> istream& operator>> (istream& in, pair <T1, T2>& a){ in >> a.first >> a.second; return in; }
template <class T> istream& operator>> (istream& in, vector <T>& a){ for (auto &x: a){ in >> x; } return in; }
using ll = long long;
using ld = long double;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
if (fopen("KEK.inp", "r")){
freopen("KEK.inp", "r", stdin);
freopen("KEK.out", "w", stdout);
}
const int M = 26;
map <array <int, M>, int> mpp;
int n;
cin >> n;
while (n--){
string s;
cin >> s;
array <int, M> cnt;
cnt.fill(0);
for (auto c: s){
cnt[c - 'a']++;
}
for (auto i = 0; i < M; i++){
cnt[i]++;
mpp[cnt]++;
cnt[i]--;
}
}
for (auto &[a, cnt]: mpp){
if (cnt == 1){
for (auto i = 0; i < M; i++){
for (auto j = 0; j < a[i]; j++){
cout << char(i + 'a');
}
}
cout << "\n";
return 0;
}
}
cout << -1 << "\n";
}