# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
515731 | 2022-01-19T14:46:44 Z | MurotY | Lozinke (COCI17_lozinke) | C++14 | 429 ms | 16812 KB |
#include<bits/stdc++.h> #define ll long long using namespace std; const int N=22222; string a[N]; int main() { int n; cin >> n; for (int i=1;i<=n;i++) cin >> a[i]; map <string, int> mp; int ans=0; for (int i=1;i<=n;i++){ map <string , int> mp1; for (int j=0;j<a[i].size();j++){ string s; for (int j1=j;j1<a[i].size();j1++){ s=s+a[i][j1]; // cout << s <<"\n"; if (mp1[s] == 0) mp1[s]++, mp[s]++; } } } for (int i=1;i<=n;i++) ans+=mp[a[i]]-1; cout << ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 972 KB | Output is correct |
2 | Correct | 1 ms | 984 KB | Output is correct |
3 | Correct | 2 ms | 984 KB | Output is correct |
4 | Correct | 2 ms | 972 KB | Output is correct |
5 | Correct | 9 ms | 1368 KB | Output is correct |
6 | Correct | 14 ms | 1256 KB | Output is correct |
7 | Correct | 19 ms | 2076 KB | Output is correct |
8 | Correct | 30 ms | 2908 KB | Output is correct |
9 | Correct | 81 ms | 2812 KB | Output is correct |
10 | Correct | 159 ms | 7812 KB | Output is correct |
11 | Correct | 131 ms | 4456 KB | Output is correct |
12 | Correct | 364 ms | 16812 KB | Output is correct |
13 | Correct | 255 ms | 2940 KB | Output is correct |
14 | Correct | 254 ms | 15044 KB | Output is correct |
15 | Correct | 429 ms | 16564 KB | Output is correct |
16 | Correct | 259 ms | 1248 KB | Output is correct |
17 | Correct | 80 ms | 1120 KB | Output is correct |
18 | Correct | 56 ms | 1144 KB | Output is correct |
19 | Correct | 269 ms | 8684 KB | Output is correct |
20 | Correct | 141 ms | 1212 KB | Output is correct |