Submission #7531734


Source Code Expand

Copy
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n;
    std::cin >> n;
    string s;
    std::cin >> s;
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        ll now = 0;
        for (int j = i; j < n; j++) {
            if(s[ j-i ] == s[ j ]){
                now++;
                ans = max(ans,min((ll)i,now));
            }else{
                now = 0;
            }
        }
    }
    std::cout << ans << std::endl;
}

Submission Info

Submission Time
Task E - Who Says a Pun?
User erbowl
Language C++14 (GCC 5.4.1)
Score 500
Code Size 492 Byte
Status AC
Exec Time 57 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 70
Set Name Test Cases
Sample 00-sample-00, 00-sample-01, 00-sample-02
All 00-sample-00, 00-sample-01, 00-sample-02, 01-handmade-03, 01-handmade-04, 01-handmade-05, 01-handmade-06, 01-handmade-07, 01-handmade-08, 01-handmade-09, 01-handmade-10, 01-handmade-11, 01-handmade-12, 02-binary-13, 02-binary-14, 02-binary-15, 02-binary-16, 02-binary-17, 02-binary-18, 02-binary-19, 02-binary-20, 02-binary-21, 02-binary-22, 02-binary-23, 03-BigRandom-24, 03-BigRandom-25, 03-BigRandom-26, 03-BigRandom-27, 03-BigRandom-28, 03-BigRandom-29, 03-BigRandom-30, 03-BigRandom-31, 03-BigRandom-32, 03-BigRandom-33, 03-BigRandom-34, 03-BigRandom-35, 03-BigRandom-36, 03-BigRandom-37, 03-BigRandom-38, 03-BigRandom-39, 03-BigRandom-40, 03-BigRandom-41, 03-BigRandom-42, 03-BigRandom-43, 03-BigRandom-44, 03-BigRandom-45, 03-BigRandom-46, 03-BigRandom-47, 03-BigRandom-48, 03-BigRandom-49, 03-BigRandom-50, 03-BigRandom-51, 03-BigRandom-52, 03-BigRandom-53, 03-BigRandom-54, 04-zero-55, 04-zero-56, 05-AllRandom-57, 05-AllRandom-58, 05-AllRandom-59, 05-AllRandom-60, 05-AllRandom-61, 05-AllRandom-62, 05-AllRandom-63, 05-AllRandom-64, 05-AllRandom-65, 05-AllRandom-66, 05-AllRandom-67, 05-AllRandom-68, 05-AllRandom-69
Case Name Status Exec Time Memory
00-sample-00 AC 1 ms 256 KB
00-sample-01 AC 1 ms 256 KB
00-sample-02 AC 1 ms 256 KB
01-handmade-03 AC 22 ms 256 KB
01-handmade-04 AC 22 ms 256 KB
01-handmade-05 AC 18 ms 256 KB
01-handmade-06 AC 18 ms 256 KB
01-handmade-07 AC 18 ms 256 KB
01-handmade-08 AC 16 ms 256 KB
01-handmade-09 AC 19 ms 256 KB
01-handmade-10 AC 24 ms 256 KB
01-handmade-11 AC 22 ms 256 KB
01-handmade-12 AC 22 ms 256 KB
02-binary-13 AC 42 ms 256 KB
02-binary-14 AC 50 ms 256 KB
02-binary-15 AC 39 ms 256 KB
02-binary-16 AC 57 ms 256 KB
02-binary-17 AC 57 ms 256 KB
02-binary-18 AC 50 ms 256 KB
02-binary-19 AC 31 ms 256 KB
02-binary-20 AC 37 ms 256 KB
02-binary-21 AC 34 ms 256 KB
02-binary-22 AC 33 ms 256 KB
02-binary-23 AC 29 ms 256 KB
03-BigRandom-24 AC 16 ms 256 KB
03-BigRandom-25 AC 16 ms 256 KB
03-BigRandom-26 AC 15 ms 256 KB
03-BigRandom-27 AC 18 ms 256 KB
03-BigRandom-28 AC 16 ms 256 KB
03-BigRandom-29 AC 17 ms 256 KB
03-BigRandom-30 AC 17 ms 256 KB
03-BigRandom-31 AC 17 ms 256 KB
03-BigRandom-32 AC 18 ms 256 KB
03-BigRandom-33 AC 16 ms 256 KB
03-BigRandom-34 AC 17 ms 256 KB
03-BigRandom-35 AC 15 ms 256 KB
03-BigRandom-36 AC 18 ms 256 KB
03-BigRandom-37 AC 17 ms 256 KB
03-BigRandom-38 AC 16 ms 256 KB
03-BigRandom-39 AC 17 ms 256 KB
03-BigRandom-40 AC 16 ms 256 KB
03-BigRandom-41 AC 17 ms 256 KB
03-BigRandom-42 AC 17 ms 256 KB
03-BigRandom-43 AC 16 ms 256 KB
03-BigRandom-44 AC 16 ms 256 KB
03-BigRandom-45 AC 18 ms 256 KB
03-BigRandom-46 AC 15 ms 256 KB
03-BigRandom-47 AC 18 ms 256 KB
03-BigRandom-48 AC 16 ms 256 KB
03-BigRandom-49 AC 16 ms 256 KB
03-BigRandom-50 AC 18 ms 256 KB
03-BigRandom-51 AC 17 ms 256 KB
03-BigRandom-52 AC 18 ms 256 KB
03-BigRandom-53 AC 18 ms 256 KB
03-BigRandom-54 AC 17 ms 256 KB
04-zero-55 AC 1 ms 256 KB
04-zero-56 AC 1 ms 256 KB
05-AllRandom-57 AC 18 ms 256 KB
05-AllRandom-58 AC 16 ms 256 KB
05-AllRandom-59 AC 18 ms 256 KB
05-AllRandom-60 AC 17 ms 256 KB
05-AllRandom-61 AC 17 ms 256 KB
05-AllRandom-62 AC 17 ms 256 KB
05-AllRandom-63 AC 16 ms 256 KB
05-AllRandom-64 AC 16 ms 256 KB
05-AllRandom-65 AC 17 ms 256 KB
05-AllRandom-66 AC 17 ms 256 KB
05-AllRandom-67 AC 17 ms 256 KB
05-AllRandom-68 AC 18 ms 256 KB
05-AllRandom-69 AC 18 ms 256 KB