Contest Duration: - (local time) (100 minutes) Back to Home

Submission #7527984

Source Code Expand

Copy
#!/usr/bin/env pypy3

def solve(n, s):
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
res_len = 0
idx = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
if s[i - 1] == s[j - 1] and dp[i - 1][j - 1] < j - i:
dp[i][j] = dp[i - 1][j - 1] + 1
if dp[i][j] > res_len:
res_len = dp[i][j]
idx = max(i, idx)
else:
dp[i][j] = 0
return res_len

def main():
n = int(input())
s = input()
res_len = solve(n, s)
print(res_len)

if __name__ == "__main__":
main()

#### Submission Info

Submission Time 2019-09-15 21:22:57+0900 E - Who Says a Pun? hamukichi PyPy3 (2.4.0) 500 655 Byte AC 735 ms 247304 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 163 ms 38256 KB
00-sample-01 AC 164 ms 38256 KB
00-sample-02 AC 162 ms 38256 KB
01-handmade-03 AC 735 ms 247048 KB
01-handmade-04 AC 688 ms 245512 KB
01-handmade-05 AC 600 ms 245384 KB
01-handmade-06 AC 608 ms 245256 KB
01-handmade-07 AC 598 ms 245384 KB
01-handmade-08 AC 675 ms 245384 KB
01-handmade-09 AC 669 ms 245256 KB
01-handmade-10 AC 682 ms 245512 KB
01-handmade-11 AC 681 ms 245256 KB
01-handmade-12 AC 689 ms 247304 KB
02-binary-13 AC 509 ms 166280 KB
02-binary-14 AC 577 ms 196872 KB
02-binary-15 AC 489 ms 161160 KB
02-binary-16 AC 617 ms 208264 KB
02-binary-17 AC 617 ms 208008 KB
02-binary-18 AC 597 ms 196616 KB
02-binary-19 AC 422 ms 134408 KB
02-binary-20 AC 461 ms 144008 KB
02-binary-21 AC 445 ms 139400 KB
02-binary-22 AC 447 ms 137480 KB
02-binary-23 AC 393 ms 125020 KB
03-BigRandom-24 AC 542 ms 206984 KB
03-BigRandom-25 AC 528 ms 206600 KB
03-BigRandom-26 AC 520 ms 203272 KB
03-BigRandom-27 AC 615 ms 244616 KB
03-BigRandom-28 AC 536 ms 211720 KB
03-BigRandom-29 AC 592 ms 240648 KB
03-BigRandom-30 AC 541 ms 212360 KB
03-BigRandom-31 AC 538 ms 212744 KB
03-BigRandom-32 AC 600 ms 244104 KB
03-BigRandom-33 AC 531 ms 206856 KB
03-BigRandom-34 AC 586 ms 238472 KB
03-BigRandom-35 AC 516 ms 203528 KB
03-BigRandom-36 AC 676 ms 243976 KB
03-BigRandom-37 AC 573 ms 235912 KB
03-BigRandom-38 AC 521 ms 206216 KB
03-BigRandom-39 AC 584 ms 240136 KB
03-BigRandom-40 AC 524 ms 209160 KB
03-BigRandom-41 AC 579 ms 239752 KB
03-BigRandom-42 AC 536 ms 212748 KB
03-BigRandom-43 AC 526 ms 207240 KB
03-BigRandom-44 AC 542 ms 209032 KB
03-BigRandom-45 AC 585 ms 241928 KB
03-BigRandom-46 AC 512 ms 203016 KB
03-BigRandom-47 AC 596 ms 244488 KB
03-BigRandom-48 AC 524 ms 209544 KB
03-BigRandom-49 AC 529 ms 209544 KB
03-BigRandom-50 AC 592 ms 244872 KB
03-BigRandom-51 AC 579 ms 238856 KB
03-BigRandom-52 AC 590 ms 242312 KB
03-BigRandom-53 AC 587 ms 243208 KB
03-BigRandom-54 AC 580 ms 240392 KB
04-zero-55 AC 158 ms 38256 KB
04-zero-56 AC 159 ms 38256 KB
05-AllRandom-57 AC 593 ms 242440 KB
05-AllRandom-58 AC 531 ms 209928 KB
05-AllRandom-59 AC 583 ms 243592 KB
05-AllRandom-60 AC 578 ms 239240 KB
05-AllRandom-61 AC 580 ms 237320 KB
05-AllRandom-62 AC 568 ms 236040 KB
05-AllRandom-63 AC 523 ms 209032 KB
05-AllRandom-64 AC 523 ms 209544 KB
05-AllRandom-65 AC 539 ms 212232 KB
05-AllRandom-66 AC 585 ms 236680 KB
05-AllRandom-67 AC 574 ms 235656 KB
05-AllRandom-68 AC 593 ms 245384 KB
05-AllRandom-69 AC 593 ms 245256 KB