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