# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077346 | 2024-08-27T05:38:19 Z | komasan | Lozinke (COCI17_lozinke) | C++14 | 1000 ms | 1112 KB |
#include <bits/stdc++.h> using namespace std; int n, ans; string st[20004]; bool check(string x, string y) { if (y.find(x)!=-1) return true; return false; } void sub1() { ans = 0; for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) if (i!=j && st[j].size()>=st[i].size() && check(st[i],st[j])) ans++; cout << ans; } void sub2() { ans = 0; for (int i=1; i<n; i++) for (int j=i+1; j<=n; j++) { if (st[i].size()>=st[j].size() && check(st[j],st[i])) ans++; if (st[j].size()>=st[i].size() && check(st[i],st[j])) ans++; } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i=1; i<=n; i++) cin >> st[i]; if (n<=1000) sub1(); else sub2(); }
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 | 856 KB | Output is correct |
4 | Correct | 5 ms | 860 KB | Output is correct |
5 | Correct | 21 ms | 860 KB | Output is correct |
6 | Correct | 48 ms | 860 KB | Output is correct |
7 | Correct | 83 ms | 860 KB | Output is correct |
8 | Correct | 66 ms | 1056 KB | Output is correct |
9 | Execution timed out | 1050 ms | 856 KB | Time limit exceeded |
10 | Execution timed out | 1067 ms | 860 KB | Time limit exceeded |
11 | Execution timed out | 1047 ms | 856 KB | Time limit exceeded |
12 | Execution timed out | 1069 ms | 860 KB | Time limit exceeded |
13 | Execution timed out | 1054 ms | 860 KB | Time limit exceeded |
14 | Execution timed out | 1070 ms | 860 KB | Time limit exceeded |
15 | Execution timed out | 1073 ms | 860 KB | Time limit exceeded |
16 | Execution timed out | 1045 ms | 1112 KB | Time limit exceeded |
17 | Execution timed out | 1057 ms | 860 KB | Time limit exceeded |
18 | Execution timed out | 1069 ms | 860 KB | Time limit exceeded |
19 | Execution timed out | 1038 ms | 856 KB | Time limit exceeded |
20 | Execution timed out | 1097 ms | 856 KB | Time limit exceeded |