QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#507224#5253. Denormalizationucup-team1525#WA 23ms10944kbPython3800b2024-08-06 13:59:452024-08-06 13:59:46

Judging History

你现在查看的是最新测评结果

  • [2024-08-06 13:59:46]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:10944kb
  • [2024-08-06 13:59:45]
  • 提交

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
    return True
    

n = int(input())
D = []

for i in range(n):
    x = float(input())
    D.append(x)
    
D2 = deepcopy(D)

mn = min(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: 10876kb

input:

2
0.909840249060
0.414958698174

output:

1423
649

result:

ok good solution

Test #2:

score: 0
Accepted
time: 11ms
memory: 10944kb

input:

3
0.005731604132
0.696198848562
0.717826101486

output:

22
2672
2755

result:

ok good solution

Test #3:

score: -100
Wrong Answer
time: 23ms
memory: 10904kb

input:

10
0.338936215010
0.390914583549
0.048893426174
0.446152513833
0.137891103101
0.017985796057
0.459132554353
0.201452557127
0.362800863500
0.358493585479

output:

74153
85525
10697
97610
30168
3935
100450
44074
79374
78432

result:

wrong answer Integer parameter [name=r_i] equals to 74153, violates the range [1, 10000]