結果
| 問題 | No.1994 Confusing Name |
| コンテスト | |
| ユーザー |
MasKoaTS
|
| 提出日時 | 2022-03-04 18:00:01 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 499 ms / 2,000 ms |
| コード長 | 769 bytes |
| 記録 | |
| コンパイル時間 | 797 ms |
| コンパイル使用メモリ | 101,004 KB |
| 実行使用メモリ | 34,304 KB |
| 最終ジャッジ日時 | 2026-06-25 10:08:32 |
| 合計ジャッジ時間 | 8,822 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
// 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;
}
MasKoaTS