結果

問題 No.2715 Unique Chimatagram
ユーザー koryoukoryou
提出日時 2024-04-05 21:29:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,286 bytes
コンパイル時間 3,429 ms
コンパイル使用メモリ 192,696 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-05 21:29:11
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 WA -
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 2 ms
6,676 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 3 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 3 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 3 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 AC 81 ms
6,676 KB
testcase_29 AC 21 ms
6,676 KB
testcase_30 AC 52 ms
6,676 KB
testcase_31 AC 8 ms
6,676 KB
testcase_32 AC 189 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 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 551 ms
6,676 KB
testcase_42 AC 515 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
#include <list>
#include <cassert>
#include <numeric>
#include <cstdint>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <random>
#include <bitset>
#include <climits>
#include <chrono>
#include <atcoder/all>
 
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
using namespace atcoder;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
using Priority = priority_queue<ll, vector<ll>, greater<ll>>;// 昇順
using PriorityPair = priority_queue<P, vector<P>, greater<P>>;
using mint17 = modint1000000007;
using mint998 = modint998244353;
using mint = modint;
 
#define mod 1000000007
#define MAX_WIDTH 60
#define MAX_HEIGHT 60
#define inf 1e9
#define INF 8e18
#define MOD 998244353
#define PI 3.141592653589793
#define rep(i, a, b) for(ll i=(a);i<(b);i++)
#define rrep(i, a, b) for(ll i=(a);i>=(b);i--)
#define fore(i, a) for(auto &i: a)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define YES(a) cout << ((a) ? "YES" : "NO") << endl
#define Yes(a) cout << ((a) ? "Yes" : "No") << endl
#define First(a) cout << ((a) ? "First" : "Second") << endl
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define vs vector<string>
#define vc vector<char>
#define vp vector<pair<ll, ll>>
#define mll map<ll, ll>
#define msl map<string, ll>
#define COUT(n) cout << (n) << endl
#define isInGrid(a, b, h, w) (0 <= (a) && (a) < (h) && 0 <= (b) && (b) < (w))
#define isInRange(n, l, r) ((l) <= (n) && (n) < (r))
#define countBit(n) __builtin_popcountll(n)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T& a, T b) { if (a <= b) { a = b; return true; } return false; }
template<typename T> void uniq(T &vec){sort(all(vec)); vec.erase(unique(all(vec)), vec.end());}
template <class T> bool isOverflowAdd(T a, T b) { return (numeric_limits<T>::max() - a) < b; }
template <class T> bool isOverflowMul(T a, T b) { return (numeric_limits<T>::max() / a) < b; }
int vy4[] = {0, 1, 0, -1}, vx4[] = {1, 0, -1, 0};
int vy8[] = {0, 1, 1, 1, 0, -1, -1, -1}, vx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
struct edge {
    ll to, cost;
};

ll N;
string S[1010];
int main() {
    cin >> N;
    vector<vll> cnt(N, vll(26, 0));
    rep(i,0,N) {
        cin >> S[i];
        for(auto c: S[i]) {
            cnt[i][c-'a']++;
        }
    }

    rep(i,0,N) {
        rep(add_c,0,26) {
            cnt[i][add_c]++;

            // check
            bool ok = true;
            rep(j,0,N) {
                if(i == j) continue;
                cnt[j][add_c]++;
                bool is_diff = false;
                rep(k,0,26) {
                    if(cnt[i][k] != cnt[j][k]) is_diff = true;
                }
                cnt[j][add_c]--;

                if(!is_diff) ok = false;
            }

            if(ok) {
                string ans = S[i]+(char)('a'+add_c);
                COUT(ans);
                return 0;
            }

            cnt[i][add_c]--;
        }
    }
    COUT(-1);

    return 0;
}
0