結果
問題 |
No.1994 Confusing Name
|
ユーザー |
![]() |
提出日時 | 2022-03-04 18:15:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 923 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 1,000 ms |
コンパイル使用メモリ | 83,428 KB |
最終ジャッジ日時 | 2025-01-28 04:37:40 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#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; }