Submission #66807357
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()))flg=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:for i in range(n):if i !=id1 and i!=id2 and a_min>a[i]:a_min=a[i]mn=iprint("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()))
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:
for i in range(n):
if i !=id1 and i!=id2 and a_min>a[i]:
a_min=a[i]
mn=i
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
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 | 819 Byte |
| Status | RE |
| Exec Time | 504 ms |
| Memory | 129048 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 | 54 ms | 76444 KiB |
| 01_handmade_00.txt | RE | 108 ms | 83868 KiB |
| 01_handmade_01.txt | RE | 108 ms | 83884 KiB |
| 01_handmade_02.txt | RE | 108 ms | 83708 KiB |
| 01_handmade_03.txt | RE | 109 ms | 83796 KiB |
| 01_handmade_04.txt | RE | 108 ms | 83772 KiB |
| 01_handmade_05.txt | RE | 108 ms | 83944 KiB |
| 01_handmade_06.txt | RE | 108 ms | 83892 KiB |
| 01_handmade_07.txt | RE | 108 ms | 84004 KiB |
| 01_handmade_08.txt | RE | 108 ms | 84024 KiB |
| 01_handmade_09.txt | RE | 109 ms | 83656 KiB |
| 01_handmade_10.txt | RE | 108 ms | 83888 KiB |
| 01_handmade_11.txt | RE | 109 ms | 83896 KiB |
| 01_handmade_12.txt | RE | 109 ms | 83824 KiB |
| 01_handmade_13.txt | RE | 109 ms | 83964 KiB |
| 01_handmade_14.txt | RE | 108 ms | 83816 KiB |
| 01_handmade_15.txt | RE | 108 ms | 83932 KiB |
| 01_handmade_16.txt | RE | 109 ms | 83792 KiB |
| 01_handmade_17.txt | RE | 109 ms | 83856 KiB |
| 01_handmade_18.txt | RE | 108 ms | 83772 KiB |
| 01_handmade_19.txt | RE | 108 ms | 83852 KiB |
| 01_handmade_20.txt | RE | 109 ms | 83880 KiB |
| 01_handmade_21.txt | RE | 108 ms | 83660 KiB |
| 01_handmade_22.txt | WA | 284 ms | 84536 KiB |
| 01_handmade_23.txt | AC | 282 ms | 84184 KiB |
| 01_handmade_24.txt | WA | 287 ms | 84760 KiB |
| 01_handmade_25.txt | AC | 123 ms | 83880 KiB |
| 02_No_00.txt | AC | 504 ms | 84136 KiB |
| 02_No_01.txt | AC | 313 ms | 83900 KiB |
| 02_No_02.txt | AC | 93 ms | 120040 KiB |
| 02_No_03.txt | AC | 92 ms | 115324 KiB |
| 03_Yes_00.txt | RE | 108 ms | 83696 KiB |
| 03_Yes_01.txt | RE | 109 ms | 83784 KiB |
| 03_Yes_02.txt | AC | 114 ms | 122956 KiB |
| 03_Yes_03.txt | AC | 115 ms | 117044 KiB |
| 03_Yes_04.txt | AC | 114 ms | 129048 KiB |
| 03_Yes_05.txt | AC | 115 ms | 129044 KiB |
| 03_Yes_06.txt | AC | 268 ms | 84820 KiB |
| 03_Yes_07.txt | AC | 225 ms | 84972 KiB |
| 04_YesNo_00.txt | AC | 261 ms | 84840 KiB |
| 04_YesNo_01.txt | AC | 223 ms | 84728 KiB |
| 04_YesNo_02.txt | RE | 264 ms | 85764 KiB |
| 04_YesNo_03.txt | AC | 224 ms | 84388 KiB |
| 04_YesNo_04.txt | AC | 267 ms | 84696 KiB |
| 04_YesNo_05.txt | AC | 221 ms | 84640 KiB |