結果

問題 No.2715 Unique Chimatagram
ユーザー anago-pieanago-pie
提出日時 2024-04-18 00:47:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,673 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 207,172 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 00:47:43
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 13 ms
6,944 KB
testcase_09 AC 12 ms
6,944 KB
testcase_10 AC 13 ms
6,944 KB
testcase_11 AC 11 ms
6,940 KB
testcase_12 AC 12 ms
6,944 KB
testcase_13 AC 11 ms
6,940 KB
testcase_14 AC 12 ms
6,944 KB
testcase_15 AC 11 ms
6,944 KB
testcase_16 AC 11 ms
6,940 KB
testcase_17 AC 11 ms
6,940 KB
testcase_18 AC 13 ms
6,944 KB
testcase_19 AC 14 ms
6,940 KB
testcase_20 AC 17 ms
6,940 KB
testcase_21 AC 14 ms
6,944 KB
testcase_22 AC 12 ms
6,940 KB
testcase_23 AC 20 ms
6,944 KB
testcase_24 AC 13 ms
6,944 KB
testcase_25 AC 13 ms
6,940 KB
testcase_26 AC 15 ms
6,940 KB
testcase_27 AC 13 ms
6,944 KB
testcase_28 AC 6 ms
6,944 KB
testcase_29 AC 7 ms
6,940 KB
testcase_30 AC 7 ms
6,944 KB
testcase_31 AC 7 ms
6,940 KB
testcase_32 AC 6 ms
6,940 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,944 KB
testcase_36 AC 1 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 7 ms
6,944 KB
testcase_40 AC 6 ms
6,940 KB
testcase_41 AC 10 ms
6,940 KB
testcase_42 AC 5 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define debug 0
#define YES cout << "Yes" << endl;
#define NO cout << "No" << endl;
using ll = long long;
using ld = long double;
const int mod = 998244353;
const int MOD = 1000000007;
const double pi = atan2(0, -1);
const int inf = 1 << 31 - 1;
const ll INF = 1LL << 63-1;
#include <time.h>
#include <chrono>

//vectorの中身を空白区切りで出力
template<typename T> 
void print1(vector<T> v) {
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
		if (i < v.size() - 1) {
			cout << " ";
		}
	}
}

//vectorの中身を改行区切りで出力
template<typename T>
void print2(vector<T> v) {
	for (auto x : v) {
		cout << x << endl;
	}
}

//二次元配列を出力
template<typename T>
void printvv(vector<vector<T>> vv) {
	for (vector<T> v : vv) {
		print1(v);
		cout << endl;
	}
}

//vectorを降順にソート
template<typename T>
void rsort(vector<T> &v) {
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
}

//昇順priority_queueを召喚
template<typename T>
struct rpriority_queue {
	priority_queue<T, vector<T>, greater<T>> pq;

	void push(T x) {
		pq.push(x);
	}

	void pop() {
		pq.pop();
	}

	T top() {
		return pq.top();
	}

	size_t size() {
		return pq.size();
	}

	bool empty() {
		return pq.empty();
	}
};

int main() {
	int N;
	cin >> N;
	map<string, int>mp;
	rep(i, N) {
		string S;
		cin >> S;
		for (char c = 'a'; c <= 'z'; c++) {
			string T = S + c;
			sort(T.begin(), T.end());
			mp[T]++;
		}
	}

	for (auto p : mp) {
		string T = p.first;
		int k = p.second;
		if (k == 1) {
			cout << T << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}
0