# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
934304 | dubious_dude | Lozinke (COCI17_lozinke) | C++17 | 1096 ms | 1116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0)->sync_with_stdio(false);
bool isTrue(string &s1, string &s2) {
if(s1 == s2) return true;
int i=0,j=0;
pair<int,int> ss1 = {0,0};
pair<int,int> ss2 = {0,0};
while(i<s1.size() && j<s2.size()) {
if(s1[i] == s2[j]) {
i++; j++;
ss1.second++;
ss2.second++;
} else {
if(s1.size() > s2.size()) {
j=0; i++;
ss2 = {0,0};
ss1 = {i,i};
}
else {
i=0; j++;
ss1 = {0,0};
ss2 = {i,i};
}
}
}
string c1 = s1.substr(ss1.first, ss1.second - ss1.first);
string c2 = s2.substr(ss2.first, ss2.second - ss2.first);
return (c1 == c2 && !c1.empty());
}
int main() {
fast_io;
int n; cin >> n;
vector<string> pass(n);
for(int i=0; i<n; i++) cin >> pass[i];
int res = 0;
for(int i=0; i<n; i++) {
for(int j=i+1; j<n; j++) {
res += (isTrue(pass[i],pass[j]) ? 1 : 0);
res += (pass[i] == pass[j]) ? 1 : 0;
}
}
cout << res;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |