結果

問題 No.2715 Unique Chimatagram
ユーザー hatsuka_iwahatsuka_iwa
提出日時 2024-04-05 22:29:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 703 bytes
コンパイル時間 1,614 ms
コンパイル使用メモリ 172,268 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-05 22:29:53
合計ジャッジ時間 4,399 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 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 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 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 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 5 ms
6,676 KB
testcase_32 WA -
testcase_33 AC 2 ms
6,676 KB
testcase_34 AC 1 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 WA -
testcase_42 AC 39 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N; cin >> N;
  vector<string> S(N); for (string &T : S) cin >> T;
  if (N == 1) {
    cout << S.at(0) + 'a' << endl;
    return 0;
  }

  for (int i = 0; i < N - 1; i++) {
    bool ok = true;
    vector<int> A(26, 0);
    for (char C : S.at(i)) A.at(C - 'a')++;
    for (int j = i + 1; j < N; j++) {
      int diff = 0;
      vector<int> B(26, 0);
      for (char C : S.at(j)) B.at(C - 'a')++;
      for (int k = 0; k < 26; k++) diff += abs(A.at(k) - B.at(k));
      if (S.at(i).size() == S.at(j).size() && diff <= 2) ok = false;
    }
    if (ok) {
      cout << S.at(i) + 'a' << endl;
      return 0;
    }
  }

  cout << -1 << endl;
}
0