# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067187 | 2024-08-20T12:37:20 Z | Celebi_276 | Lozinke (COCI17_lozinke) | C++17 | 303 ms | 16748 KB |
#include <algorithm> #include <iostream> #include <climits> #include <cstdio> #include <string> #include <vector> #include <map> using namespace std; #define MultiTest(k) int k; cin >> k; while (k--) #define all(v) v.begin(), v.end() #define ll long long int #define pll pair<ll, ll> #define pii pair<int, int> #define NAME "" string s[20022]; int n, Z(0); map <string, int> mp, ok; void process (string s) { int l = s.length(); vector <string> C; for (int i = 0; i < l; i++) for (int j = i; j < l; j++) { string t = s.substr(i, j - i + 1); if (!ok[t]) C.push_back(t); ok[t] = 1; } for (string t : C) mp[t]++; ok.clear(); } signed main () { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); if (fopen(NAME".INP", "r")) { freopen(NAME".INP", "r", stdin); freopen(NAME".OUT", "w", stdout); } cin >> n; for (int i = 1; i <= n; i++) { cin >> s[i]; process(s[i]); } for (int i = 1; i <= n; i++) Z += mp[s[i]]; cout << Z - n; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 860 KB | Output is correct |
2 | Correct | 0 ms | 860 KB | Output is correct |
3 | Correct | 1 ms | 1088 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 7 ms | 1372 KB | Output is correct |
6 | Correct | 11 ms | 1432 KB | Output is correct |
7 | Correct | 19 ms | 2140 KB | Output is correct |
8 | Correct | 24 ms | 2904 KB | Output is correct |
9 | Correct | 59 ms | 2744 KB | Output is correct |
10 | Correct | 161 ms | 8016 KB | Output is correct |
11 | Correct | 100 ms | 4440 KB | Output is correct |
12 | Correct | 281 ms | 16748 KB | Output is correct |
13 | Correct | 185 ms | 2968 KB | Output is correct |
14 | Correct | 186 ms | 15236 KB | Output is correct |
15 | Correct | 303 ms | 16740 KB | Output is correct |
16 | Correct | 186 ms | 1616 KB | Output is correct |
17 | Correct | 56 ms | 1288 KB | Output is correct |
18 | Correct | 46 ms | 1112 KB | Output is correct |
19 | Correct | 194 ms | 8788 KB | Output is correct |
20 | Correct | 103 ms | 1332 KB | Output is correct |