結果

問題 No.2715 Unique Chimatagram
ユーザー GandalfrGandalfr
提出日時 2024-04-05 21:43:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 5,751 bytes
コンパイル時間 2,991 ms
コンパイル使用メモリ 234,720 KB
実行使用メモリ 8,120 KB
最終ジャッジ日時 2024-04-05 21:44:23
合計ジャッジ時間 4,745 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;


}
0