Submission #66808023
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-1)//(max(b[id1],b[id2]))
else:
c=(10**8-1)//(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 | 997 Byte |
| Status | WA |
| Exec Time | 496 ms |
| Memory | 129084 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 | 76156 KiB |
| 01_handmade_00.txt | WA | 92 ms | 83508 KiB |
| 01_handmade_01.txt | WA | 379 ms | 84648 KiB |
| 01_handmade_02.txt | WA | 377 ms | 84460 KiB |
| 01_handmade_03.txt | WA | 370 ms | 84460 KiB |
| 01_handmade_04.txt | AC | 365 ms | 84632 KiB |
| 01_handmade_05.txt | WA | 368 ms | 84604 KiB |
| 01_handmade_06.txt | WA | 356 ms | 84436 KiB |
| 01_handmade_07.txt | WA | 362 ms | 84596 KiB |
| 01_handmade_08.txt | WA | 365 ms | 85012 KiB |
| 01_handmade_09.txt | WA | 362 ms | 84440 KiB |
| 01_handmade_10.txt | WA | 371 ms | 84416 KiB |
| 01_handmade_11.txt | WA | 366 ms | 84664 KiB |
| 01_handmade_12.txt | WA | 361 ms | 84716 KiB |
| 01_handmade_13.txt | WA | 365 ms | 84632 KiB |
| 01_handmade_14.txt | WA | 360 ms | 85012 KiB |
| 01_handmade_15.txt | WA | 359 ms | 84704 KiB |
| 01_handmade_16.txt | WA | 358 ms | 84700 KiB |
| 01_handmade_17.txt | WA | 364 ms | 84844 KiB |
| 01_handmade_18.txt | WA | 364 ms | 84436 KiB |
| 01_handmade_19.txt | AC | 366 ms | 84592 KiB |
| 01_handmade_20.txt | WA | 362 ms | 84456 KiB |
| 01_handmade_21.txt | WA | 359 ms | 84456 KiB |
| 01_handmade_22.txt | WA | 282 ms | 84116 KiB |
| 01_handmade_23.txt | AC | 280 ms | 83840 KiB |
| 01_handmade_24.txt | WA | 279 ms | 84064 KiB |
| 01_handmade_25.txt | AC | 119 ms | 83824 KiB |
| 02_No_00.txt | AC | 496 ms | 84352 KiB |
| 02_No_01.txt | AC | 309 ms | 83696 KiB |
| 02_No_02.txt | AC | 93 ms | 120108 KiB |
| 02_No_03.txt | AC | 92 ms | 115312 KiB |
| 03_Yes_00.txt | AC | 380 ms | 84916 KiB |
| 03_Yes_01.txt | AC | 373 ms | 84912 KiB |
| 03_Yes_02.txt | AC | 115 ms | 122780 KiB |
| 03_Yes_03.txt | AC | 115 ms | 117236 KiB |
| 03_Yes_04.txt | AC | 114 ms | 129084 KiB |
| 03_Yes_05.txt | AC | 116 ms | 129064 KiB |
| 03_Yes_06.txt | AC | 264 ms | 84672 KiB |
| 03_Yes_07.txt | AC | 216 ms | 83864 KiB |
| 04_YesNo_00.txt | AC | 264 ms | 84848 KiB |
| 04_YesNo_01.txt | AC | 223 ms | 83988 KiB |
| 04_YesNo_02.txt | AC | 268 ms | 84584 KiB |
| 04_YesNo_03.txt | AC | 226 ms | 83892 KiB |
| 04_YesNo_04.txt | AC | 271 ms | 85420 KiB |
| 04_YesNo_05.txt | AC | 223 ms | 84684 KiB |