Submission #64135279
Source Code Expand
Copy
def is_sub(A, B, index=0):N, M = len(A), len(B)j = 0for i in range(index, N):if A[i] == B[j]:j += 1if j == M:return i + 1return -1def f(A, B):match = is_sub(A, B)if match == -1:return "No"s_match = is_sub(A, B, match)return "Yes" if s_match != -1 else "No"
def is_sub(A, B, index=0):
N, M = len(A), len(B)
j = 0
for i in range(index, N):
if A[i] == B[j]:
j += 1
if j == M:
return i + 1
return -1
def f(A, B):
match = is_sub(A, B)
if match == -1:
return "No"
s_match = is_sub(A, B, match)
return "Yes" if s_match != -1 else "No"
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
print(has_duplicate_subsequence(A, B))
Submission Info
| Submission Time | |
|---|---|
| Task | A - Twice Subsequence |
| User | kotafuku |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 0 |
| Code Size | 536 Byte |
| Status | RE |
| Exec Time | 158 ms |
| Memory | 138788 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 03_medium_01.txt, 03_medium_02.txt, 03_medium_03.txt, 03_medium_04.txt, 03_medium_05.txt, 04_large_01.txt, 04_large_02.txt, 04_large_03.txt, 04_large_04.txt, 04_large_05.txt, 05_max_01.txt, 05_max_02.txt, 05_max_03.txt, 05_max_04.txt, 05_max_05.txt, 06_not_emerge_01.txt, 06_not_emerge_02.txt, 06_not_emerge_03.txt, 07_emerge_once_01.txt, 07_emerge_once_02.txt, 07_emerge_once_03.txt, 07_emerge_once_04.txt, 07_emerge_once_05.txt, 08_emerge_twice_01.txt, 08_emerge_twice_02.txt, 08_emerge_twice_03.txt, 08_emerge_twice_04.txt, 08_emerge_twice_05.txt, 09_one_two_only_01.txt, 09_one_two_only_02.txt, 09_one_two_only_03.txt, 09_one_two_only_04.txt, 09_one_two_only_05.txt, 09_one_two_only_06.txt, 09_one_two_only_07.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | RE | 113 ms | 84656 KiB |
| 00_sample_02.txt | RE | 112 ms | 84772 KiB |
| 00_sample_03.txt | RE | 113 ms | 84680 KiB |
| 01_handmade_01.txt | RE | 113 ms | 84888 KiB |
| 01_handmade_02.txt | RE | 158 ms | 120172 KiB |
| 01_handmade_03.txt | RE | 147 ms | 138632 KiB |
| 01_handmade_04.txt | RE | 147 ms | 138788 KiB |
| 01_handmade_05.txt | RE | 147 ms | 138576 KiB |
| 02_small_01.txt | RE | 112 ms | 84676 KiB |
| 02_small_02.txt | RE | 112 ms | 84476 KiB |
| 02_small_03.txt | RE | 112 ms | 84564 KiB |
| 02_small_04.txt | RE | 113 ms | 84648 KiB |
| 02_small_05.txt | RE | 112 ms | 84696 KiB |
| 03_medium_01.txt | RE | 113 ms | 84796 KiB |
| 03_medium_02.txt | RE | 112 ms | 84700 KiB |
| 03_medium_03.txt | RE | 112 ms | 84724 KiB |
| 03_medium_04.txt | RE | 112 ms | 84628 KiB |
| 03_medium_05.txt | RE | 112 ms | 84544 KiB |
| 04_large_01.txt | RE | 116 ms | 85876 KiB |
| 04_large_02.txt | RE | 146 ms | 114704 KiB |
| 04_large_03.txt | RE | 157 ms | 118232 KiB |
| 04_large_04.txt | RE | 131 ms | 103680 KiB |
| 04_large_05.txt | RE | 143 ms | 118436 KiB |
| 05_max_01.txt | RE | 155 ms | 119904 KiB |
| 05_max_02.txt | RE | 156 ms | 118592 KiB |
| 05_max_03.txt | RE | 157 ms | 119896 KiB |
| 05_max_04.txt | RE | 158 ms | 118388 KiB |
| 05_max_05.txt | RE | 157 ms | 118088 KiB |
| 06_not_emerge_01.txt | RE | 138 ms | 115616 KiB |
| 06_not_emerge_02.txt | RE | 138 ms | 115452 KiB |
| 06_not_emerge_03.txt | RE | 137 ms | 114260 KiB |
| 07_emerge_once_01.txt | RE | 144 ms | 119656 KiB |
| 07_emerge_once_02.txt | RE | 157 ms | 118524 KiB |
| 07_emerge_once_03.txt | RE | 154 ms | 117928 KiB |
| 07_emerge_once_04.txt | RE | 157 ms | 118044 KiB |
| 07_emerge_once_05.txt | RE | 137 ms | 114184 KiB |
| 08_emerge_twice_01.txt | RE | 143 ms | 119740 KiB |
| 08_emerge_twice_02.txt | RE | 155 ms | 115628 KiB |
| 08_emerge_twice_03.txt | RE | 152 ms | 117624 KiB |
| 08_emerge_twice_04.txt | RE | 149 ms | 117692 KiB |
| 08_emerge_twice_05.txt | RE | 153 ms | 117960 KiB |
| 09_one_two_only_01.txt | RE | 139 ms | 123060 KiB |
| 09_one_two_only_02.txt | RE | 139 ms | 122752 KiB |
| 09_one_two_only_03.txt | RE | 138 ms | 121416 KiB |
| 09_one_two_only_04.txt | RE | 137 ms | 120104 KiB |
| 09_one_two_only_05.txt | RE | 140 ms | 129052 KiB |
| 09_one_two_only_06.txt | RE | 133 ms | 113128 KiB |
| 09_one_two_only_07.txt | RE | 140 ms | 124432 KiB |