| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1011502 | MilosMilutinovic | Necklace (Subtask 1-3) (BOI19_necklace1) | C++14 | 1558 ms | 265044 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
string t;
cin >> t;
int n = (int) s.size();
int m = (int) t.size();
map<string, bool> has;
map<string, int> pos;
auto Add = [&](string s, int p) {
int n = (int) s.size();
for (int i = 0; i < n; i++) {
string c = "";
for (int j = 0; j < n; j++) {
c += s[(i + j) % n];
has[c] = true;
pos[c] = p;
}
}
reverse(s.begin(), s.end());
for (int i = 0; i < n; i++) {
string c = "";
for (int j = 0; j < n; j++) {
c += s[(i + j) % n];
has[c] = true;
pos[c] = p;
}
}
};
for (int l = 0; l < n; l++) {
string c = "";
for (int r = l; r < n; r++) {
c += s[r];
Add(c, l);
}
}
array<int, 3> res = {0, 0, 0};
for (int l = 0; l < n; l++) {
string c = "";
for (int r = l; r < n; r++) {
c += t[r];
if (has[c]) {
res = max(res, {(int) c.size(), pos[c], l});
}
}
}
cout << res[0] << '\n' << res[1] << " " << res[2] << '\n';
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
