# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
935986 | 2024-02-29T20:46:52 Z | sapientsapiens | Lozinke (COCI17_lozinke) | C++14 | 88 ms | 856 KB |
#include <iostream> #include <string> #include <utility> using namespace std; int n; string str[2005]; int ans = 0; bool check(string a, string b) // checks if a is contained in b { if(a.size() > b.size()) { swap(a, b); } for(int i = 0; i < b.size(); i++) { if(b[i] == a[0]) { bool c = true; for(int j = 0; j < a.size(); j++) { if(b[i + j] != a[j]){ c = false; break; } } if(c) return true; } } return false; } int main() { cin >> n; for(int i = 0; i < n; i++) { cin >> str[i]; } for(int i = 0; i < n; i++) { for(int j = i+ 1; j < n; j++) { if(str[i] == str[j]) { ans += 2; continue; } if(check(str[i], str[j])) ans++; //test i on j } } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 4 ms | 348 KB | Output is correct |
5 | Correct | 25 ms | 500 KB | Output is correct |
6 | Correct | 68 ms | 484 KB | Output is correct |
7 | Correct | 88 ms | 344 KB | Output is correct |
8 | Correct | 68 ms | 348 KB | Output is correct |
9 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
10 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
11 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
12 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
13 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
14 | Runtime error | 2 ms | 604 KB | Execution killed with signal 11 |
15 | Runtime error | 2 ms | 784 KB | Execution killed with signal 11 |
16 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
17 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
18 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
19 | Runtime error | 1 ms | 856 KB | Execution killed with signal 11 |
20 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |