結果

問題 No.1994 Confusing Name
ユーザー MasKoaTS
提出日時 2022-02-23 16:49:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 655 bytes
コンパイル時間 1,149 ms
コンパイル使用メモリ 77,136 KB
最終ジャッジ日時 2025-01-28 01:30:55
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

// TLE

#include <iostream>
#include <vector>
#include <map>
#define rep(i, l, n) for (int i = (l); i < (n); i++)
using namespace std;
using str = string;
template <class T>
using V = vector<T>;


int main(void) {
	int n;	cin >> n;
	V<str> s(n);
	rep(i, 0, n) {
		cin >> s[i];
	}

	V<int> ans(n);
	rep(i, 0, n - 1) {
		rep(j, i + 1, n) {
			if (s[i].size() != s[j].size()) {
				continue;
			}
			int cnt = 0;
			rep(k, 0, s[i].size()) {
				if (s[i][k] != s[j][k]) {
					cnt++;
				}
				if (cnt > 1) {
					break;
				}
			}
			if (cnt > 1) {
				continue;
			}
			ans[i]++;	ans[j]++;
		}
	}

	rep(i, 0, n) {
		cout << ans[i] << endl;
	}

	return 0;
}
0