結果
問題 | No.1994 Confusing Name |
ユーザー | otoshigo |
提出日時 | 2022-07-01 21:40:15 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 516 ms / 2,000 ms |
コード長 | 1,120 bytes |
コンパイル時間 | 2,121 ms |
コンパイル使用メモリ | 214,700 KB |
実行使用メモリ | 54,896 KB |
最終ジャッジ日時 | 2024-05-04 15:57:37 |
合計ジャッジ時間 | 9,605 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
19,072 KB |
testcase_01 | AC | 6 ms
18,944 KB |
testcase_02 | AC | 5 ms
18,944 KB |
testcase_03 | AC | 5 ms
19,072 KB |
testcase_04 | AC | 6 ms
19,072 KB |
testcase_05 | AC | 8 ms
19,320 KB |
testcase_06 | AC | 10 ms
19,628 KB |
testcase_07 | AC | 6 ms
19,200 KB |
testcase_08 | AC | 8 ms
19,412 KB |
testcase_09 | AC | 10 ms
19,584 KB |
testcase_10 | AC | 7 ms
19,496 KB |
testcase_11 | AC | 10 ms
19,316 KB |
testcase_12 | AC | 337 ms
41,124 KB |
testcase_13 | AC | 500 ms
52,480 KB |
testcase_14 | AC | 499 ms
54,068 KB |
testcase_15 | AC | 414 ms
48,256 KB |
testcase_16 | AC | 347 ms
44,520 KB |
testcase_17 | AC | 370 ms
47,540 KB |
testcase_18 | AC | 510 ms
54,400 KB |
testcase_19 | AC | 508 ms
54,656 KB |
testcase_20 | AC | 516 ms
54,896 KB |
testcase_21 | AC | 76 ms
25,804 KB |
testcase_22 | AC | 38 ms
22,492 KB |
testcase_23 | AC | 430 ms
47,736 KB |
testcase_24 | AC | 405 ms
46,464 KB |
testcase_25 | AC | 251 ms
36,736 KB |
testcase_26 | AC | 113 ms
28,160 KB |
testcase_27 | AC | 386 ms
44,160 KB |
testcase_28 | AC | 263 ms
38,392 KB |
testcase_29 | AC | 33 ms
21,888 KB |
testcase_30 | AC | 292 ms
40,016 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for (int i = 0; i < n; i++) #define rrep(i,n) for (int i = n-1; i >= 0; i--) #define rep2(i,a,b) for (int i = a; i < b; i++) #define rrep2(i,a,b) for (int i = a-1; i >= b; i--) #define rep3(i,a,b,c) for (int i = a; i < b; i+=c) #define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} int n; string S[500010]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin>>n; map<pair<string,string>,int>mp; rep(i,n){ cin>>S[i]; int l=S[i].size(); rep(j,l){ mp[make_pair(S[i].substr(0,j),S[i].substr(j+1,l-j+1))]++; } } rep(i,n){ int l=S[i].size(),cnt=0; rep(j,l){ cnt+=mp[make_pair(S[i].substr(0,j),S[i].substr(j+1,l-j+1))]; } cnt-=l; cout<<cnt<<"\n"; } }