結果
問題 | No.2715 Unique Chimatagram |
ユーザー | Gandalfr |
提出日時 | 2024-04-05 21:43:57 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 5,751 bytes |
コンパイル時間 | 3,338 ms |
コンパイル使用メモリ | 233,660 KB |
実行使用メモリ | 8,144 KB |
最終ジャッジ日時 | 2024-10-01 01:59:32 |
合計ジャッジ時間 | 5,049 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#line 1 "freespace/main.cpp" #include <bits/stdc++.h> #line 2 "library/gandalfr/types.hpp" #line 5 "library/gandalfr/types.hpp" namespace gandalfr { using i8 = __int8_t; using i16 = __int16_t; using i32 = __int32_t; using i64 = __int64_t; using i128 = __int128_t; using u8 = __uint8_t; using u16 = __uint16_t; using u32 = __uint32_t; using u64 = __uint64_t; using u128 = __uint128_t; constexpr i8 IMAX8 = INT8_MAX; constexpr i16 IMAX16 = INT16_MAX; constexpr i32 IMAX32 = INT32_MAX; constexpr i64 IMAX64 = INT64_MAX; constexpr i8 IMIN8 = INT8_MIN; constexpr i16 IMIN16 = INT16_MIN; constexpr i32 IMIN32 = INT32_MIN; constexpr i64 IMIN64 = INT64_MIN; constexpr u8 UMAX8 = UINT8_MAX; constexpr u16 UMAX16 = UINT16_MAX; constexpr u32 UMAX32 = UINT32_MAX; constexpr u64 UMAX64 = UINT64_MAX; constexpr i64 MOD998 = 998244353; constexpr i64 MOD107 = 1000000007; constexpr double PI = M_PI; const i32 INF = 1001001001; const i64 INFLL = 1001001001001001001; #define rep(i, j, n) for (i64 i = (i64)(j); i < (i64)(n); i++) #define rrep(i, j, n) for (i64 i = (i64)(n - 1); i >= (i64)(j); i--) #define all(a) (a).begin(), (a).end() #define LF cout << endl template <typename T> void print_debug(T t) { std::cerr << t << std::endl; } template <typename First, typename... Rest> void print_debug(First parm1, Rest... parm) { std::cerr << parm1 << ", ", print_debug(parm...); } #define debug(...) \ { \ std::cerr << #__VA_ARGS__ << ": "; \ print_debug(__VA_ARGS__); \ } template <typename T> inline bool chmax(T &a, const T &b) { return a < b && (a = b, true); } template <typename T> inline bool chmin(T &a, const T &b) { return a > b && (a = b, true); } template <typename Key, typename Value> inline bool map_chmax(std::map<Key, Value> &mp, const Key &a, const Value &b) { auto it = mp.find(a); return it == mp.end() ? (mp[a] = b, true) : chmax(it->second, b); } template <typename Key, typename Value> inline bool map_chmin(std::map<Key, Value> &mp, const Key &a, const Value &b) { auto it = mp.find(a); return it == mp.end() ? (mp[a] = b, true) : chmin(it->second, b); } void Yes(bool ok) { std::cout << (ok ? "Yes" : "No") << std::endl; } } // namespace gandalfr #line 10 "library/gandalfr/other/io.hpp" template <typename T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) { for (size_t i = 0; i < v.size(); ++i) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } template <typename T> std::ostream &operator<<(std::ostream &os, const std::set<T> &st) { for (auto it = st.begin(); it != st.end(); ++it) { os << *it << (std::next(it) != st.end() ? " " : ""); } return os; } template <typename T> std::ostream &operator<<(std::ostream &os, const std::multiset<T> &st) { for (auto it = st.begin(); it != st.end(); ++it) { os << *it << (std::next(it) != st.end() ? " " : ""); } return os; } template <typename T1, typename T2> std::ostream &operator<<(std::ostream &os, const std::pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; } template <typename T> std::ostream &operator<<(std::ostream &os, std::queue<T> q) { while (!q.empty()) { os << q.front() << (q.size() > 1 ? " " : ""); q.pop(); } return os; } template <typename T> std::ostream &operator<<(std::ostream &os, const std::deque<T> &dq) { for (size_t i = 0; i < dq.size(); ++i) { os << dq[i] << (i + 1 != dq.size() ? " " : ""); } return os; } template <typename Tp, typename Sequence, typename Compare> std::ostream &operator<<(std::ostream &os, std::priority_queue<Tp, Sequence, Compare> q) { while (!q.empty()) { os << q.top() << (q.size() > 1 ? " " : ""); q.pop(); } return os; } template <typename Key, typename T> std::ostream &operator<<(std::ostream &os, const std::map<Key, T> &m) { for (auto it = m.begin(); it != m.end(); ++it) { os << *it << (std::next(it) != m.end() ? " " : ""); } return os; } template <typename Key, typename T> std::ostream &operator<<(std::ostream &os, const std::unordered_map<Key, T> &um) { for (auto it = um.begin(); it != um.end(); ++it) { os << *it << (std::next(it) != um.end() ? " " : ""); } return os; } ///////////////////// input ///////////////////// template <typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &in : v) is >> in; return is; } template <typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) { is >> p.first >> p.second; return is; } #line 2 "library/gandalfr/standard/HashMap.hpp" #include <ext/pb_ds/assoc_container.hpp> #line 5 "library/gandalfr/standard/HashMap.hpp" namespace gandalfr { template <typename Key, typename Value, typename Hash = std::hash<Key>, typename Eq = std::equal_to<Key>> using HashMap = __gnu_pbds::gp_hash_table<Key, Value, Hash, Eq>; } #line 5 "freespace/main.cpp" using namespace std; using namespace gandalfr; int main(void) { i32 N; cin >> N; HashMap<string, i32> mp; rep(i,0,N) { string s; cin >> s; rep(c,0,26) { string tmp = s + char('a' + c); sort(all(tmp)); mp[tmp]++; } } for (auto [str, v] : mp) { if (v == 1) { cout << str << endl; return 0; } } cout<< -1 << endl; }