# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472783 | 2021-09-14T10:25:20 Z | AbdoMo | Lozinke (COCI17_lozinke) | C++17 | 1000 ms | 1484 KB |
#include<bits/stdc++.h> #define int long long #define ll long long #define pb push_back const int mod = 1e9+7; using namespace std; bool comp(string a,string b) { if(a.size()==b.size()) { return a<b; } return a.size()<b.size(); } void solve(){ int n; cin>>n; vector<string>v; for(int i=0;i<n;i++) { string s; cin>>s; v.pb(s); } sort(v.begin(),v.end(),comp); int ans=0; for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(v[i].size()==v[j].size()) { if(v[i]==v[j]) ans+=2; } else { if(v[j].find(v[i])!=-1) { ans++; } } } } cout<<ans<<endl; /* */ } int32_t main(){ int t=1; ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //cin>>t; while(t--){solve();} return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 12 ms | 376 KB | Output is correct |
6 | Correct | 29 ms | 332 KB | Output is correct |
7 | Correct | 44 ms | 332 KB | Output is correct |
8 | Correct | 29 ms | 332 KB | Output is correct |
9 | Execution timed out | 1018 ms | 848 KB | Time limit exceeded |
10 | Correct | 784 ms | 848 KB | Output is correct |
11 | Execution timed out | 1086 ms | 976 KB | Time limit exceeded |
12 | Execution timed out | 1080 ms | 848 KB | Time limit exceeded |
13 | Execution timed out | 1095 ms | 1484 KB | Time limit exceeded |
14 | Execution timed out | 1079 ms | 1484 KB | Time limit exceeded |
15 | Execution timed out | 1089 ms | 1484 KB | Time limit exceeded |
16 | Execution timed out | 1093 ms | 1484 KB | Time limit exceeded |
17 | Execution timed out | 1004 ms | 1484 KB | Time limit exceeded |
18 | Execution timed out | 1086 ms | 1484 KB | Time limit exceeded |
19 | Execution timed out | 1082 ms | 1484 KB | Time limit exceeded |
20 | Execution timed out | 1067 ms | 1484 KB | Time limit exceeded |