# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
928924 | 2024-02-17T08:14:35 Z | Ghulam_Junaid | Necklace (Subtask 1-3) (BOI19_necklace1) | C++17 | 1500 ms | 432 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int n, m; string s, t; cin >> s >> t; n = s.size(); m = t.size(); int len = 0; pair<int, int> mp[3005]; for (int i = 0; i < n; i ++){ string tmp; for (int j = i; j < n; j ++){ tmp += s[j]; int sz = tmp.size(); for (int k = 0; k < sz; k ++){ string x; for (int l = k; l < k + sz; l ++) x += tmp[l % sz]; if (t.find(x) != string::npos and len < sz){ len = sz; mp[len] = {i, t.find(x)}; } } } } reverse(s.begin(), s.end()); for (int i = 0; i < n; i ++){ string tmp; for (int j = i; j < n; j ++){ tmp += s[j]; int sz = tmp.size(); for (int k = 0; k < sz; k ++){ string x; for (int l = k; l < k + sz; l ++) x += tmp[l % sz]; if (t.find(x) != string::npos and len < sz){ len = sz; mp[len] = { n - (i + len - 1) - 1, t.find(x)}; } } } } cout << len << endl; cout << mp[len].first << " " << mp[len].second << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 348 KB | Output is correct |
2 | Correct | 114 ms | 428 KB | Output is correct |
3 | Correct | 74 ms | 348 KB | Output is correct |
4 | Correct | 116 ms | 432 KB | Output is correct |
5 | Correct | 83 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 348 KB | Output is correct |
2 | Correct | 114 ms | 428 KB | Output is correct |
3 | Correct | 74 ms | 348 KB | Output is correct |
4 | Correct | 116 ms | 432 KB | Output is correct |
5 | Correct | 83 ms | 348 KB | Output is correct |
6 | Execution timed out | 1542 ms | 428 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 348 KB | Output is correct |
2 | Correct | 114 ms | 428 KB | Output is correct |
3 | Correct | 74 ms | 348 KB | Output is correct |
4 | Correct | 116 ms | 432 KB | Output is correct |
5 | Correct | 83 ms | 348 KB | Output is correct |
6 | Execution timed out | 1542 ms | 428 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |