Submission #6000445
Source Code Expand
N=int(input()) T = list(map(int,input().split())) A = list(map(int,input().split())) count=0 for i in range(N): if A[i]==T[N-1] and T[i]==T[N-1]: count+=1 if count==0: print(0) else: count=max(0,count-2) mod = 10**9+7 d = pow(T[N-1],count,mod) from collections import Counter tc=Counter(T) for key in tc.keys(): if key!=T[N-1]: d*=pow(key,tc[key]-1,mod) d%=mod ac=Counter(A) for key in ac.keys(): if key!=T[N-1]: d*=pow(key,ac[key]-1,mod) d%=mod print(d)
Submission Info
Submission Time | |
---|---|
Task | C - Two Alpinists |
User | rikein12 |
Language | PyPy3 (2.4.0) |
Score | 400 |
Code Size | 616 Byte |
Status | AC |
Exec Time | 287 ms |
Memory | 83408 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 166 ms | 38256 KB |
0_001.txt | AC | 161 ms | 38256 KB |
0_002.txt | AC | 163 ms | 38256 KB |
0_003.txt | AC | 166 ms | 38256 KB |
1_004.txt | AC | 167 ms | 38256 KB |
1_005.txt | AC | 169 ms | 38256 KB |
1_006.txt | AC | 164 ms | 38256 KB |
1_007.txt | AC | 164 ms | 38256 KB |
1_008.txt | AC | 270 ms | 82020 KB |
1_009.txt | AC | 274 ms | 79328 KB |
1_010.txt | AC | 281 ms | 81692 KB |
1_011.txt | AC | 287 ms | 83408 KB |
1_012.txt | AC | 259 ms | 78828 KB |
1_013.txt | AC | 274 ms | 79836 KB |
1_014.txt | AC | 260 ms | 80156 KB |
1_015.txt | AC | 268 ms | 80420 KB |
1_016.txt | AC | 255 ms | 79204 KB |
1_017.txt | AC | 262 ms | 77736 KB |
1_018.txt | AC | 249 ms | 74044 KB |
1_019.txt | AC | 252 ms | 71788 KB |
1_020.txt | AC | 233 ms | 64540 KB |