結果

問題 No.1994 Confusing Name
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-04 18:00:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 868 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 83,472 KB
実行使用メモリ 34,252 KB
最終ジャッジ日時 2023-09-25 19:00:16
合計ジャッジ時間 12,203 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 7 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,376 KB
testcase_12 AC 686 ms
26,544 KB
testcase_13 AC 868 ms
32,616 KB
testcase_14 AC 662 ms
32,412 KB
testcase_15 AC 530 ms
27,616 KB
testcase_16 AC 453 ms
24,432 KB
testcase_17 AC 514 ms
27,196 KB
testcase_18 AC 720 ms
33,892 KB
testcase_19 AC 722 ms
33,940 KB
testcase_20 AC 715 ms
34,252 KB
testcase_21 AC 102 ms
9,516 KB
testcase_22 AC 43 ms
6,260 KB
testcase_23 AC 620 ms
29,568 KB
testcase_24 AC 619 ms
28,656 KB
testcase_25 AC 348 ms
19,540 KB
testcase_26 AC 157 ms
11,624 KB
testcase_27 AC 551 ms
26,940 KB
testcase_28 AC 378 ms
21,276 KB
testcase_29 AC 34 ms
5,772 KB
testcase_30 AC 424 ms
22,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// multiset を利用

#include <iostream>
#include <vector>
#include <set>
#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);
	multiset<str> st = {};
	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('.');
					continue;
				}
				t.push_back(s[i][k]);
			}
			st.insert(t);
		}
	}

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

	return 0;
}
0