# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379775 | 2021-03-19T09:23:58 Z | FatihSolak | Lozinke (COCI17_lozinke) | C++17 | 547 ms | 16876 KB |
#include <bits/stdc++.h> #define N 20005 using namespace std; map<string,int> mp; string s[N]; void solve(){ int n; cin >> n; int ans = 0; for(int i=0;i<n;i++){ cin >> s[i]; mp[s[i]]++; } for(int i=0;i<n;i++){ set<string> st; for(int j=0;j<s[i].size();j++){ string tmp = ""; for(int c = j;c<s[i].size();c++){ tmp += s[i][c]; st.insert(tmp); } } for(auto u:st){ ans += mp[u]; } } cout << ans-n; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); #ifdef Local freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif int t=1; //cin>>t; while(t--){ solve(); } #ifdef Local cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds "; #endif }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1004 KB | Output is correct |
2 | Correct | 1 ms | 1152 KB | Output is correct |
3 | Correct | 2 ms | 1004 KB | Output is correct |
4 | Correct | 2 ms | 1004 KB | Output is correct |
5 | Correct | 11 ms | 1388 KB | Output is correct |
6 | Correct | 18 ms | 1388 KB | Output is correct |
7 | Correct | 23 ms | 2028 KB | Output is correct |
8 | Correct | 37 ms | 2924 KB | Output is correct |
9 | Correct | 97 ms | 2796 KB | Output is correct |
10 | Correct | 215 ms | 7916 KB | Output is correct |
11 | Correct | 166 ms | 4460 KB | Output is correct |
12 | Correct | 463 ms | 16876 KB | Output is correct |
13 | Correct | 325 ms | 2924 KB | Output is correct |
14 | Correct | 337 ms | 15212 KB | Output is correct |
15 | Correct | 547 ms | 16488 KB | Output is correct |
16 | Correct | 302 ms | 1516 KB | Output is correct |
17 | Correct | 87 ms | 1132 KB | Output is correct |
18 | Correct | 53 ms | 1132 KB | Output is correct |
19 | Correct | 327 ms | 8812 KB | Output is correct |
20 | Correct | 149 ms | 1388 KB | Output is correct |