結果
問題 | No.2715 Unique Chimatagram |
ユーザー |
![]() |
提出日時 | 2024-04-05 22:06:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 2,578 ms |
コンパイル使用メモリ | 208,328 KB |
最終ジャッジ日時 | 2025-02-20 21:24:33 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;void solve() {ll n;cin >> n;map<string, ll> mp;vector<string> S;for (ll i = 0; i < n; ++i) {string s;cin >> s;sort(s.begin(), s.end());S.push_back(s);}for (ll i = 0; i < n; ++i) {for (char c = 'a'; c <= 'z'; ++c) {string tmp(S[i]);tmp.push_back(c);sort(tmp.begin(), tmp.end());++mp[tmp];}}for (auto m : mp) {if (m.second == 1) {cout << m.first << endl;return;}}cout << -1 << endl;}int main() {solve();return 0;}