# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
935986 | sapientsapiens | Lozinke (COCI17_lozinke) | C++14 | 88 ms | 856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |