Submission #1006111

# Submission time Handle Problem Language Result Execution time Memory
1006111 2024-06-23T12:13:13 Z AverageAmogusEnjoyer Necklace (Subtask 1-3) (BOI19_necklace1) C++17
0 / 85
51 ms 348 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; }
template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    string s,t;
    cin >> s >> t;
    int n = (int)t.size();
    int ans = 0;
    auto search = [&]() {
        for (int i=0;i<n;i++) {
            for (int j=i;j<n;j++) {
                for (int k=i;k>=0;k--) {
                    string r = s.substr(i,j-i+1);
                    string f = s.substr(k,i-k);
                    r += f;
                    if (t.find(r) != string::npos) {
                        cmax(ans,(int)r.size());
                    }
                }
            }
        }
    };
    search();
    reverse(t.begin(),t.end());
    search();
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -