結果

問題 No.1994 Confusing Name
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-04 18:15:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 604 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 88,824 KB
実行使用メモリ 30,228 KB
最終ジャッジ日時 2023-09-25 19:21:52
合計ジャッジ時間 9,560 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 6 ms
4,376 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 4 ms
4,384 KB
testcase_12 AC 394 ms
20,516 KB
testcase_13 AC 535 ms
28,432 KB
testcase_14 AC 555 ms
29,500 KB
testcase_15 AC 434 ms
25,260 KB
testcase_16 AC 356 ms
22,288 KB
testcase_17 AC 426 ms
24,700 KB
testcase_18 AC 568 ms
30,024 KB
testcase_19 AC 600 ms
29,956 KB
testcase_20 AC 604 ms
30,228 KB
testcase_21 AC 83 ms
8,216 KB
testcase_22 AC 37 ms
5,736 KB
testcase_23 AC 521 ms
24,936 KB
testcase_24 AC 496 ms
24,200 KB
testcase_25 AC 283 ms
16,772 KB
testcase_26 AC 121 ms
9,896 KB
testcase_27 AC 442 ms
22,292 KB
testcase_28 AC 310 ms
17,804 KB
testcase_29 AC 28 ms
5,400 KB
testcase_30 AC 346 ms
19,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
	map<str, int> mp = {};
	rep(i, 0, n) {
		cin >> s[i];
		rep(j, 0, s[i].size()) {
			str t = s[i];
			mp[t.replace(j, 1, ".")]++;
		}
	}

	rep(i, 0, n) {
		int ans = 0;
		rep(j, 0, s[i].size()) {
			str t = s[i];
			ans += mp[t.replace(j, 1, ".")] - 1;
		}
		cout << ans << endl;
	}

	return 0;
}
0