Submission #66807701
Source Code Expand
Copy
inf=1<<60for _ in range(int(input())):n=int(input())a=list(map(int,input().split()))b=list(map(int,input().split()))if n==1:print("No")continueflg=1a_min=inffor i in range(n):if a[i]*b[(i+1)%n]!=a[(i+1)%n]*b[i]:flg=0id1,id2=i,(i+1)%nif flg:print("No")else:print("Yes")ans=[0]*n
inf=1<<60 for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) if n==1: print("No") continue flg=1 a_min=inf for i in range(n): if a[i]*b[(i+1)%n]!=a[(i+1)%n]*b[i]: flg=0 id1,id2=i,(i+1)%n if flg: print("No") else: print("Yes") ans=[0]*n ans[id1]=b[id2] ans[id2]=-b[id1] if a[id1]*b[id2]-a[id2]*b[id1]<0: c=-1 c*=10**8//(max(b[id1],b[id2])) else: c=10**8//(max(b[id1],b[id2])) for i in range(n): ans[i]*=c if n==2: ans[0]-=1 ans[1]-=1 else: for i in range(n): if i !=id1 and i!=id2 and a_min>a[i]: a_min=a[i] mn=i ans[mn]=-1 print(*ans)
Submission Info
Submission Time | |
---|---|
Task | A - Dot Product |
User | juten |
Language | Python (PyPy 3.10-v7.3.12) |
Score | 0 |
Code Size | 989 Byte |
Status | WA |
Exec Time | 534 ms |
Memory | 129108 KiB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt |
All | 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 01_handmade_16.txt, 01_handmade_17.txt, 01_handmade_18.txt, 01_handmade_19.txt, 01_handmade_20.txt, 01_handmade_21.txt, 01_handmade_22.txt, 01_handmade_23.txt, 01_handmade_24.txt, 01_handmade_25.txt, 02_No_00.txt, 02_No_01.txt, 02_No_02.txt, 02_No_03.txt, 03_Yes_00.txt, 03_Yes_01.txt, 03_Yes_02.txt, 03_Yes_03.txt, 03_Yes_04.txt, 03_Yes_05.txt, 03_Yes_06.txt, 03_Yes_07.txt, 04_YesNo_00.txt, 04_YesNo_01.txt, 04_YesNo_02.txt, 04_YesNo_03.txt, 04_YesNo_04.txt, 04_YesNo_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 56 ms | 76472 KiB |
01_handmade_00.txt | WA | 93 ms | 83228 KiB |
01_handmade_01.txt | WA | 388 ms | 84856 KiB |
01_handmade_02.txt | WA | 384 ms | 84604 KiB |
01_handmade_03.txt | WA | 387 ms | 84600 KiB |
01_handmade_04.txt | WA | 387 ms | 84856 KiB |
01_handmade_05.txt | WA | 384 ms | 84944 KiB |
01_handmade_06.txt | WA | 368 ms | 84812 KiB |
01_handmade_07.txt | WA | 382 ms | 85060 KiB |
01_handmade_08.txt | WA | 383 ms | 84876 KiB |
01_handmade_09.txt | WA | 377 ms | 84948 KiB |
01_handmade_10.txt | WA | 383 ms | 84764 KiB |
01_handmade_11.txt | WA | 382 ms | 84660 KiB |
01_handmade_12.txt | WA | 381 ms | 84856 KiB |
01_handmade_13.txt | WA | 382 ms | 84496 KiB |
01_handmade_14.txt | WA | 384 ms | 84980 KiB |
01_handmade_15.txt | WA | 382 ms | 85056 KiB |
01_handmade_16.txt | WA | 384 ms | 85064 KiB |
01_handmade_17.txt | WA | 386 ms | 84800 KiB |
01_handmade_18.txt | WA | 386 ms | 84668 KiB |
01_handmade_19.txt | AC | 388 ms | 84592 KiB |
01_handmade_20.txt | WA | 382 ms | 84576 KiB |
01_handmade_21.txt | WA | 380 ms | 84616 KiB |
01_handmade_22.txt | WA | 300 ms | 83872 KiB |
01_handmade_23.txt | AC | 301 ms | 84076 KiB |
01_handmade_24.txt | WA | 298 ms | 84152 KiB |
01_handmade_25.txt | AC | 125 ms | 83532 KiB |
02_No_00.txt | AC | 534 ms | 84444 KiB |
02_No_01.txt | AC | 323 ms | 84232 KiB |
02_No_02.txt | AC | 95 ms | 120140 KiB |
02_No_03.txt | AC | 95 ms | 115404 KiB |
03_Yes_00.txt | WA | 393 ms | 84476 KiB |
03_Yes_01.txt | AC | 375 ms | 84600 KiB |
03_Yes_02.txt | AC | 116 ms | 122588 KiB |
03_Yes_03.txt | AC | 115 ms | 117064 KiB |
03_Yes_04.txt | AC | 114 ms | 129108 KiB |
03_Yes_05.txt | AC | 116 ms | 128672 KiB |
03_Yes_06.txt | AC | 271 ms | 84872 KiB |
03_Yes_07.txt | AC | 220 ms | 83932 KiB |
04_YesNo_00.txt | AC | 269 ms | 84880 KiB |
04_YesNo_01.txt | AC | 226 ms | 84272 KiB |
04_YesNo_02.txt | AC | 269 ms | 84720 KiB |
04_YesNo_03.txt | AC | 227 ms | 83864 KiB |
04_YesNo_04.txt | AC | 278 ms | 85844 KiB |
04_YesNo_05.txt | AC | 224 ms | 84664 KiB |