結果

問題 No.1994 Confusing Name
ユーザー MasKoaTSMasKoaTS
提出日時 2022-02-23 16:40:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 644 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 941 ms
コンパイル使用メモリ 90,268 KB
実行使用メモリ 30,272 KB
最終ジャッジ日時 2023-09-17 05:08:54
合計ジャッジ時間 10,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 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,380 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 440 ms
20,472 KB
testcase_13 AC 580 ms
28,648 KB
testcase_14 AC 611 ms
29,760 KB
testcase_15 AC 482 ms
25,296 KB
testcase_16 AC 403 ms
22,528 KB
testcase_17 AC 479 ms
24,792 KB
testcase_18 AC 638 ms
30,256 KB
testcase_19 AC 644 ms
30,164 KB
testcase_20 AC 640 ms
30,272 KB
testcase_21 AC 88 ms
8,380 KB
testcase_22 AC 39 ms
5,892 KB
testcase_23 AC 541 ms
25,240 KB
testcase_24 AC 527 ms
24,272 KB
testcase_25 AC 299 ms
16,924 KB
testcase_26 AC 136 ms
10,232 KB
testcase_27 AC 465 ms
22,560 KB
testcase_28 AC 328 ms
17,744 KB
testcase_29 AC 31 ms
5,372 KB
testcase_30 AC 365 ms
19,340 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 = "";
			rep(k, 0, s[i].size()) {
				if (j == k) {
					t.push_back('.');
				}
				else {
					t.push_back(s[i][k]);
				}
			}
			mp[t]++;
		}
	}

	V<int> ans(n);
	rep(i, 0, n) {
		rep(j, 0, s[i].size()) {
			str t = "";
			rep(k, 0, s[i].size()) {
				if (j == k) {
					t.push_back('.');
				}
				else {
					t.push_back(s[i][k]);
				}
			}
			ans[i] += mp[t] - 1;
		}
		cout << ans[i] << endl;
	}

	return 0;
}
0