結果
問題 | No.1994 Confusing Name |
ユーザー | otoshigo |
提出日時 | 2022-07-01 21:40:15 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 640 ms / 2,000 ms |
コード長 | 1,120 bytes |
コンパイル時間 | 2,486 ms |
コンパイル使用メモリ | 210,572 KB |
実行使用メモリ | 54,836 KB |
最終ジャッジ日時 | 2023-08-17 09:06:10 |
合計ジャッジ時間 | 11,433 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
19,004 KB |
testcase_01 | AC | 8 ms
19,012 KB |
testcase_02 | AC | 8 ms
19,212 KB |
testcase_03 | AC | 8 ms
19,032 KB |
testcase_04 | AC | 8 ms
19,016 KB |
testcase_05 | AC | 11 ms
19,264 KB |
testcase_06 | AC | 13 ms
19,548 KB |
testcase_07 | AC | 9 ms
19,116 KB |
testcase_08 | AC | 13 ms
19,444 KB |
testcase_09 | AC | 13 ms
19,768 KB |
testcase_10 | AC | 10 ms
19,280 KB |
testcase_11 | AC | 10 ms
19,340 KB |
testcase_12 | AC | 377 ms
41,060 KB |
testcase_13 | AC | 580 ms
52,404 KB |
testcase_14 | AC | 570 ms
53,956 KB |
testcase_15 | AC | 468 ms
48,264 KB |
testcase_16 | AC | 399 ms
44,800 KB |
testcase_17 | AC | 461 ms
47,584 KB |
testcase_18 | AC | 636 ms
54,448 KB |
testcase_19 | AC | 640 ms
54,664 KB |
testcase_20 | AC | 639 ms
54,836 KB |
testcase_21 | AC | 93 ms
25,700 KB |
testcase_22 | AC | 46 ms
22,248 KB |
testcase_23 | AC | 518 ms
47,676 KB |
testcase_24 | AC | 473 ms
46,308 KB |
testcase_25 | AC | 289 ms
36,844 KB |
testcase_26 | AC | 127 ms
28,060 KB |
testcase_27 | AC | 472 ms
44,188 KB |
testcase_28 | AC | 318 ms
38,364 KB |
testcase_29 | AC | 37 ms
21,812 KB |
testcase_30 | AC | 345 ms
40,136 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"; } }