QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#507229 | #5253. Denormalization | ucup-team1525# | WA | 55ms | 11024kb | Python3 | 854b | 2024-08-06 14:06:50 | 2024-08-06 14:06:50 |
Judging History
answer
import math
from copy import deepcopy
# check norm
def check_norm(D, ans):
n = len(D)
norm_ans = math.sqrt(sum([x**2 for x in ans]))
for i in range(n):
if math.fabs(ans[i] / norm_ans - D[i]) > 1e-6:
return False
if ans[i] > 10000:
return False
return True
n = int(input())
D = []
for i in range(n):
x = float(input())
D.append(x)
D2 = deepcopy(D)
mn = max(D)
for i in range(n):
D[i] /= mn
for K in range(1, 10001):
A = []
for i in range(n):
A.append(int(D[i] * K))
gcd = A[0]
for i in range(1, n):
gcd = math.gcd(gcd, A[i])
for i in range(n):
A[i] //= gcd
if (check_norm(D2, A)):
for x in A:
print(x)
exit(0)
assert(False)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 10888kb
input:
2 0.909840249060 0.414958698174
output:
1127 514
result:
ok good solution
Test #2:
score: 0
Accepted
time: 22ms
memory: 11024kb
input:
3 0.005731604132 0.696198848562 0.717826101486
output:
31 3766 3883
result:
ok good solution
Test #3:
score: -100
Wrong Answer
time: 55ms
memory: 10876kb
input:
10 0.338936215010 0.390914583549 0.048893426174 0.446152513833 0.137891103101 0.017985796057 0.459132554353 0.201452557127 0.362800863500 0.358493585479
output:
result:
wrong output format Unexpected end of file - int32 expected