# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
80252 | 2018-10-19T16:50:05 Z | MatheusLealV | Lozinke (COCI17_lozinke) | C++17 | 1000 ms | 17508 KB |
#include <bits/stdc++.h> #define N 20050 using namespace std; typedef long long ll; int n; ll ans; map<string, int> mapa; string v[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n; for(int t = 1; t <= n; t++) { string s; set<string> ss; cin>>s; v[t] = s; ans += (ll)mapa[s]; for(int i = 0; i < s.size(); i++) { string aux; for(int j = i; j < s.size(); j++) { aux.push_back(s[j]); ss.insert(aux); } } for(auto x: ss) mapa[x] ++; } mapa.clear(); for(int t = n; t >= 1; t--) { string s = v[t]; set<string> ss; ans += (ll)mapa[s]; for(int i = 0; i < s.size(); i++) { string aux; for(int j = i; j < s.size(); j++) { aux.push_back(s[j]); ss.insert(aux); } } for(auto x: ss) mapa[x] ++; } cout<<ans<<"\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1016 KB | Output is correct |
2 | Correct | 3 ms | 1024 KB | Output is correct |
3 | Correct | 4 ms | 1072 KB | Output is correct |
4 | Correct | 5 ms | 1248 KB | Output is correct |
5 | Correct | 28 ms | 1584 KB | Output is correct |
6 | Correct | 40 ms | 1584 KB | Output is correct |
7 | Correct | 49 ms | 2320 KB | Output is correct |
8 | Correct | 77 ms | 3232 KB | Output is correct |
9 | Correct | 238 ms | 3280 KB | Output is correct |
10 | Correct | 461 ms | 8300 KB | Output is correct |
11 | Correct | 340 ms | 8300 KB | Output is correct |
12 | Execution timed out | 1074 ms | 17308 KB | Time limit exceeded |
13 | Correct | 611 ms | 17308 KB | Output is correct |
14 | Correct | 719 ms | 17308 KB | Output is correct |
15 | Execution timed out | 1076 ms | 17508 KB | Time limit exceeded |
16 | Correct | 592 ms | 17508 KB | Output is correct |
17 | Correct | 142 ms | 17508 KB | Output is correct |
18 | Correct | 102 ms | 17508 KB | Output is correct |
19 | Correct | 964 ms | 17508 KB | Output is correct |
20 | Correct | 286 ms | 17508 KB | Output is correct |