結果

問題 No.1994 Confusing Name
ユーザー polyesterpolyester
提出日時 2022-07-01 21:55:17
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 833 bytes
コンパイル時間 1,536 ms
コンパイル使用メモリ 144,320 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-05-04 16:20:04
合計ジャッジ時間 5,207 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,760 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<string> vs(n);
  for(int i = 0; i < n; i++) {
    cin >> vs[i];
  }
  vector<int> ans(n);
  for(int i = 0; i < n; i++) {
    for(int j = i + 1; j < n; j++) {
      if(vs[i].size() != vs[j].size()) {
        continue;
      }
      int cnt = 0;
      for(int k = 0; k < vs[j].size(); k++) {
        if(vs[i][k] != vs[j][k]) {
          cnt++;
        }
      }
      if(cnt == 1) {
        ans[i]++;
        ans[j]++;
      }
    }
  }
  for(int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
0