QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#870456 | #8611. (A + B) mod P | ucup-team5243# | AC ✓ | 287ms | 9216kb | Python3 | 1.3kb | 2025-01-25 16:27:03 | 2025-01-25 16:27:04 |
Judging History
answer
def solve(Winput,Woutput):
P = len(Winput)
N = len(Winput[0])
for a in range(P):
for b in range(P):
M = [max(0,Winput[a][i] + Winput[b][i]) for i in range(N)]
scores = []
for i in range(P):
tmp = 0.0
for j in range(N):
tmp += M[j]*Woutput[i][j]
scores.append(tmp)
# print(a, b, M, scores.index(max(scores)), scores)
if not (scores.index(max(scores)) == (a+b)%P and scores.count(max(scores)) == 1) :
print(a, b)
p = int(input())
n = 4
Winput = [[] for _ in range(4)]
Winput[0] = [i for i in range(p)]
Winput[1] = [i - p / 2 for i in range(p)]
Winput[2] = [i - p / 2 + 0.5 for i in range(p)]
Winput[3] = [0.5 for i in range(p)]
Winput = [[Winput[b][a] for b in range(n)] for a in range(p)]
Woutput = [[] for _ in range(4)]
Woutput[0] = [2 * i / 100 for i in range(p)]
Woutput[1] = [2*i*p / 100 for i in range(p)]
Woutput[2] = [-Woutput[1][i] for i in range(p)]
Woutput[3] = [(p * p - i * i) / 100 for i in range(p)]
Woutput = [[Woutput[b][a] for b in range(n)] for a in range(p)]
print(4)
for x in Winput :
print(" ".join(map(str, x)))
print()
for y in Woutput :
print(" ".join(map(str, y)))
solve(Winput, Woutput)
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 9088kb
input:
3
output:
4 0 -1.5 -1.0 0.5 1 -0.5 0.0 0.5 2 0.5 1.0 0.5 0.0 0.0 -0.0 0.09 0.02 0.06 -0.06 0.08 0.04 0.12 -0.12 0.05
result:
ok OK
Test #2:
score: 0
Accepted
time: 8ms
memory: 8960kb
input:
5
output:
4 0 -2.5 -2.0 0.5 1 -1.5 -1.0 0.5 2 -0.5 0.0 0.5 3 0.5 1.0 0.5 4 1.5 2.0 0.5 0.0 0.0 -0.0 0.25 0.02 0.1 -0.1 0.24 0.04 0.2 -0.2 0.21 0.06 0.3 -0.3 0.16 0.08 0.4 -0.4 0.09
result:
ok OK
Test #3:
score: 0
Accepted
time: 9ms
memory: 9088kb
input:
7
output:
4 0 -3.5 -3.0 0.5 1 -2.5 -2.0 0.5 2 -1.5 -1.0 0.5 3 -0.5 0.0 0.5 4 0.5 1.0 0.5 5 1.5 2.0 0.5 6 2.5 3.0 0.5 0.0 0.0 -0.0 0.49 0.02 0.14 -0.14 0.48 0.04 0.28 -0.28 0.45 0.06 0.42 -0.42 0.4 0.08 0.56 -0.56 0.33 0.1 0.7 -0.7 0.24 0.12 0.84 -0.84 0.13
result:
ok OK
Test #4:
score: 0
Accepted
time: 12ms
memory: 8960kb
input:
11
output:
4 0 -5.5 -5.0 0.5 1 -4.5 -4.0 0.5 2 -3.5 -3.0 0.5 3 -2.5 -2.0 0.5 4 -1.5 -1.0 0.5 5 -0.5 0.0 0.5 6 0.5 1.0 0.5 7 1.5 2.0 0.5 8 2.5 3.0 0.5 9 3.5 4.0 0.5 10 4.5 5.0 0.5 0.0 0.0 -0.0 1.21 0.02 0.22 -0.22 1.2 0.04 0.44 -0.44 1.17 0.06 0.66 -0.66 1.12 0.08 0.88 -0.88 1.05 0.1 1.1 -1.1 0.96 0.12 1.32 -1...
result:
ok OK
Test #5:
score: 0
Accepted
time: 8ms
memory: 8832kb
input:
13
output:
4 0 -6.5 -6.0 0.5 1 -5.5 -5.0 0.5 2 -4.5 -4.0 0.5 3 -3.5 -3.0 0.5 4 -2.5 -2.0 0.5 5 -1.5 -1.0 0.5 6 -0.5 0.0 0.5 7 0.5 1.0 0.5 8 1.5 2.0 0.5 9 2.5 3.0 0.5 10 3.5 4.0 0.5 11 4.5 5.0 0.5 12 5.5 6.0 0.5 0.0 0.0 -0.0 1.69 0.02 0.26 -0.26 1.68 0.04 0.52 -0.52 1.65 0.06 0.78 -0.78 1.6 0.08 1.04 -1.04 1.5...
result:
ok OK
Test #6:
score: 0
Accepted
time: 13ms
memory: 8960kb
input:
17
output:
4 0 -8.5 -8.0 0.5 1 -7.5 -7.0 0.5 2 -6.5 -6.0 0.5 3 -5.5 -5.0 0.5 4 -4.5 -4.0 0.5 5 -3.5 -3.0 0.5 6 -2.5 -2.0 0.5 7 -1.5 -1.0 0.5 8 -0.5 0.0 0.5 9 0.5 1.0 0.5 10 1.5 2.0 0.5 11 2.5 3.0 0.5 12 3.5 4.0 0.5 13 4.5 5.0 0.5 14 5.5 6.0 0.5 15 6.5 7.0 0.5 16 7.5 8.0 0.5 0.0 0.0 -0.0 2.89 0.02 0.34 -0.34 2...
result:
ok OK
Test #7:
score: 0
Accepted
time: 10ms
memory: 8960kb
input:
19
output:
4 0 -9.5 -9.0 0.5 1 -8.5 -8.0 0.5 2 -7.5 -7.0 0.5 3 -6.5 -6.0 0.5 4 -5.5 -5.0 0.5 5 -4.5 -4.0 0.5 6 -3.5 -3.0 0.5 7 -2.5 -2.0 0.5 8 -1.5 -1.0 0.5 9 -0.5 0.0 0.5 10 0.5 1.0 0.5 11 1.5 2.0 0.5 12 2.5 3.0 0.5 13 3.5 4.0 0.5 14 4.5 5.0 0.5 15 5.5 6.0 0.5 16 6.5 7.0 0.5 17 7.5 8.0 0.5 18 8.5 9.0 0.5 0.0...
result:
ok OK
Test #8:
score: 0
Accepted
time: 12ms
memory: 8960kb
input:
23
output:
4 0 -11.5 -11.0 0.5 1 -10.5 -10.0 0.5 2 -9.5 -9.0 0.5 3 -8.5 -8.0 0.5 4 -7.5 -7.0 0.5 5 -6.5 -6.0 0.5 6 -5.5 -5.0 0.5 7 -4.5 -4.0 0.5 8 -3.5 -3.0 0.5 9 -2.5 -2.0 0.5 10 -1.5 -1.0 0.5 11 -0.5 0.0 0.5 12 0.5 1.0 0.5 13 1.5 2.0 0.5 14 2.5 3.0 0.5 15 3.5 4.0 0.5 16 4.5 5.0 0.5 17 5.5 6.0 0.5 18 6.5 7.0 ...
result:
ok OK
Test #9:
score: 0
Accepted
time: 17ms
memory: 9088kb
input:
29
output:
4 0 -14.5 -14.0 0.5 1 -13.5 -13.0 0.5 2 -12.5 -12.0 0.5 3 -11.5 -11.0 0.5 4 -10.5 -10.0 0.5 5 -9.5 -9.0 0.5 6 -8.5 -8.0 0.5 7 -7.5 -7.0 0.5 8 -6.5 -6.0 0.5 9 -5.5 -5.0 0.5 10 -4.5 -4.0 0.5 11 -3.5 -3.0 0.5 12 -2.5 -2.0 0.5 13 -1.5 -1.0 0.5 14 -0.5 0.0 0.5 15 0.5 1.0 0.5 16 1.5 2.0 0.5 17 2.5 3.0 0.5...
result:
ok OK
Test #10:
score: 0
Accepted
time: 20ms
memory: 9088kb
input:
31
output:
4 0 -15.5 -15.0 0.5 1 -14.5 -14.0 0.5 2 -13.5 -13.0 0.5 3 -12.5 -12.0 0.5 4 -11.5 -11.0 0.5 5 -10.5 -10.0 0.5 6 -9.5 -9.0 0.5 7 -8.5 -8.0 0.5 8 -7.5 -7.0 0.5 9 -6.5 -6.0 0.5 10 -5.5 -5.0 0.5 11 -4.5 -4.0 0.5 12 -3.5 -3.0 0.5 13 -2.5 -2.0 0.5 14 -1.5 -1.0 0.5 15 -0.5 0.0 0.5 16 0.5 1.0 0.5 17 1.5 2.0...
result:
ok OK
Test #11:
score: 0
Accepted
time: 28ms
memory: 9088kb
input:
37
output:
4 0 -18.5 -18.0 0.5 1 -17.5 -17.0 0.5 2 -16.5 -16.0 0.5 3 -15.5 -15.0 0.5 4 -14.5 -14.0 0.5 5 -13.5 -13.0 0.5 6 -12.5 -12.0 0.5 7 -11.5 -11.0 0.5 8 -10.5 -10.0 0.5 9 -9.5 -9.0 0.5 10 -8.5 -8.0 0.5 11 -7.5 -7.0 0.5 12 -6.5 -6.0 0.5 13 -5.5 -5.0 0.5 14 -4.5 -4.0 0.5 15 -3.5 -3.0 0.5 16 -2.5 -2.0 0.5 1...
result:
ok OK
Test #12:
score: 0
Accepted
time: 30ms
memory: 8960kb
input:
41
output:
4 0 -20.5 -20.0 0.5 1 -19.5 -19.0 0.5 2 -18.5 -18.0 0.5 3 -17.5 -17.0 0.5 4 -16.5 -16.0 0.5 5 -15.5 -15.0 0.5 6 -14.5 -14.0 0.5 7 -13.5 -13.0 0.5 8 -12.5 -12.0 0.5 9 -11.5 -11.0 0.5 10 -10.5 -10.0 0.5 11 -9.5 -9.0 0.5 12 -8.5 -8.0 0.5 13 -7.5 -7.0 0.5 14 -6.5 -6.0 0.5 15 -5.5 -5.0 0.5 16 -4.5 -4.0 0...
result:
ok OK
Test #13:
score: 0
Accepted
time: 34ms
memory: 9088kb
input:
43
output:
4 0 -21.5 -21.0 0.5 1 -20.5 -20.0 0.5 2 -19.5 -19.0 0.5 3 -18.5 -18.0 0.5 4 -17.5 -17.0 0.5 5 -16.5 -16.0 0.5 6 -15.5 -15.0 0.5 7 -14.5 -14.0 0.5 8 -13.5 -13.0 0.5 9 -12.5 -12.0 0.5 10 -11.5 -11.0 0.5 11 -10.5 -10.0 0.5 12 -9.5 -9.0 0.5 13 -8.5 -8.0 0.5 14 -7.5 -7.0 0.5 15 -6.5 -6.0 0.5 16 -5.5 -5.0...
result:
ok OK
Test #14:
score: 0
Accepted
time: 44ms
memory: 9088kb
input:
47
output:
4 0 -23.5 -23.0 0.5 1 -22.5 -22.0 0.5 2 -21.5 -21.0 0.5 3 -20.5 -20.0 0.5 4 -19.5 -19.0 0.5 5 -18.5 -18.0 0.5 6 -17.5 -17.0 0.5 7 -16.5 -16.0 0.5 8 -15.5 -15.0 0.5 9 -14.5 -14.0 0.5 10 -13.5 -13.0 0.5 11 -12.5 -12.0 0.5 12 -11.5 -11.0 0.5 13 -10.5 -10.0 0.5 14 -9.5 -9.0 0.5 15 -8.5 -8.0 0.5 16 -7.5 ...
result:
ok OK
Test #15:
score: 0
Accepted
time: 58ms
memory: 9216kb
input:
53
output:
4 0 -26.5 -26.0 0.5 1 -25.5 -25.0 0.5 2 -24.5 -24.0 0.5 3 -23.5 -23.0 0.5 4 -22.5 -22.0 0.5 5 -21.5 -21.0 0.5 6 -20.5 -20.0 0.5 7 -19.5 -19.0 0.5 8 -18.5 -18.0 0.5 9 -17.5 -17.0 0.5 10 -16.5 -16.0 0.5 11 -15.5 -15.0 0.5 12 -14.5 -14.0 0.5 13 -13.5 -13.0 0.5 14 -12.5 -12.0 0.5 15 -11.5 -11.0 0.5 16 -...
result:
ok OK
Test #16:
score: 0
Accepted
time: 73ms
memory: 9088kb
input:
59
output:
4 0 -29.5 -29.0 0.5 1 -28.5 -28.0 0.5 2 -27.5 -27.0 0.5 3 -26.5 -26.0 0.5 4 -25.5 -25.0 0.5 5 -24.5 -24.0 0.5 6 -23.5 -23.0 0.5 7 -22.5 -22.0 0.5 8 -21.5 -21.0 0.5 9 -20.5 -20.0 0.5 10 -19.5 -19.0 0.5 11 -18.5 -18.0 0.5 12 -17.5 -17.0 0.5 13 -16.5 -16.0 0.5 14 -15.5 -15.0 0.5 15 -14.5 -14.0 0.5 16 -...
result:
ok OK
Test #17:
score: 0
Accepted
time: 82ms
memory: 9088kb
input:
61
output:
4 0 -30.5 -30.0 0.5 1 -29.5 -29.0 0.5 2 -28.5 -28.0 0.5 3 -27.5 -27.0 0.5 4 -26.5 -26.0 0.5 5 -25.5 -25.0 0.5 6 -24.5 -24.0 0.5 7 -23.5 -23.0 0.5 8 -22.5 -22.0 0.5 9 -21.5 -21.0 0.5 10 -20.5 -20.0 0.5 11 -19.5 -19.0 0.5 12 -18.5 -18.0 0.5 13 -17.5 -17.0 0.5 14 -16.5 -16.0 0.5 15 -15.5 -15.0 0.5 16 -...
result:
ok OK
Test #18:
score: 0
Accepted
time: 113ms
memory: 9088kb
input:
67
output:
4 0 -33.5 -33.0 0.5 1 -32.5 -32.0 0.5 2 -31.5 -31.0 0.5 3 -30.5 -30.0 0.5 4 -29.5 -29.0 0.5 5 -28.5 -28.0 0.5 6 -27.5 -27.0 0.5 7 -26.5 -26.0 0.5 8 -25.5 -25.0 0.5 9 -24.5 -24.0 0.5 10 -23.5 -23.0 0.5 11 -22.5 -22.0 0.5 12 -21.5 -21.0 0.5 13 -20.5 -20.0 0.5 14 -19.5 -19.0 0.5 15 -18.5 -18.0 0.5 16 -...
result:
ok OK
Test #19:
score: 0
Accepted
time: 115ms
memory: 8960kb
input:
71
output:
4 0 -35.5 -35.0 0.5 1 -34.5 -34.0 0.5 2 -33.5 -33.0 0.5 3 -32.5 -32.0 0.5 4 -31.5 -31.0 0.5 5 -30.5 -30.0 0.5 6 -29.5 -29.0 0.5 7 -28.5 -28.0 0.5 8 -27.5 -27.0 0.5 9 -26.5 -26.0 0.5 10 -25.5 -25.0 0.5 11 -24.5 -24.0 0.5 12 -23.5 -23.0 0.5 13 -22.5 -22.0 0.5 14 -21.5 -21.0 0.5 15 -20.5 -20.0 0.5 16 -...
result:
ok OK
Test #20:
score: 0
Accepted
time: 123ms
memory: 8960kb
input:
73
output:
4 0 -36.5 -36.0 0.5 1 -35.5 -35.0 0.5 2 -34.5 -34.0 0.5 3 -33.5 -33.0 0.5 4 -32.5 -32.0 0.5 5 -31.5 -31.0 0.5 6 -30.5 -30.0 0.5 7 -29.5 -29.0 0.5 8 -28.5 -28.0 0.5 9 -27.5 -27.0 0.5 10 -26.5 -26.0 0.5 11 -25.5 -25.0 0.5 12 -24.5 -24.0 0.5 13 -23.5 -23.0 0.5 14 -22.5 -22.0 0.5 15 -21.5 -21.0 0.5 16 -...
result:
ok OK
Test #21:
score: 0
Accepted
time: 160ms
memory: 9088kb
input:
79
output:
4 0 -39.5 -39.0 0.5 1 -38.5 -38.0 0.5 2 -37.5 -37.0 0.5 3 -36.5 -36.0 0.5 4 -35.5 -35.0 0.5 5 -34.5 -34.0 0.5 6 -33.5 -33.0 0.5 7 -32.5 -32.0 0.5 8 -31.5 -31.0 0.5 9 -30.5 -30.0 0.5 10 -29.5 -29.0 0.5 11 -28.5 -28.0 0.5 12 -27.5 -27.0 0.5 13 -26.5 -26.0 0.5 14 -25.5 -25.0 0.5 15 -24.5 -24.0 0.5 16 -...
result:
ok OK
Test #22:
score: 0
Accepted
time: 184ms
memory: 8960kb
input:
83
output:
4 0 -41.5 -41.0 0.5 1 -40.5 -40.0 0.5 2 -39.5 -39.0 0.5 3 -38.5 -38.0 0.5 4 -37.5 -37.0 0.5 5 -36.5 -36.0 0.5 6 -35.5 -35.0 0.5 7 -34.5 -34.0 0.5 8 -33.5 -33.0 0.5 9 -32.5 -32.0 0.5 10 -31.5 -31.0 0.5 11 -30.5 -30.0 0.5 12 -29.5 -29.0 0.5 13 -28.5 -28.0 0.5 14 -27.5 -27.0 0.5 15 -26.5 -26.0 0.5 16 -...
result:
ok OK
Test #23:
score: 0
Accepted
time: 218ms
memory: 9088kb
input:
89
output:
4 0 -44.5 -44.0 0.5 1 -43.5 -43.0 0.5 2 -42.5 -42.0 0.5 3 -41.5 -41.0 0.5 4 -40.5 -40.0 0.5 5 -39.5 -39.0 0.5 6 -38.5 -38.0 0.5 7 -37.5 -37.0 0.5 8 -36.5 -36.0 0.5 9 -35.5 -35.0 0.5 10 -34.5 -34.0 0.5 11 -33.5 -33.0 0.5 12 -32.5 -32.0 0.5 13 -31.5 -31.0 0.5 14 -30.5 -30.0 0.5 15 -29.5 -29.0 0.5 16 -...
result:
ok OK
Test #24:
score: 0
Accepted
time: 287ms
memory: 9088kb
input:
97
output:
4 0 -48.5 -48.0 0.5 1 -47.5 -47.0 0.5 2 -46.5 -46.0 0.5 3 -45.5 -45.0 0.5 4 -44.5 -44.0 0.5 5 -43.5 -43.0 0.5 6 -42.5 -42.0 0.5 7 -41.5 -41.0 0.5 8 -40.5 -40.0 0.5 9 -39.5 -39.0 0.5 10 -38.5 -38.0 0.5 11 -37.5 -37.0 0.5 12 -36.5 -36.0 0.5 13 -35.5 -35.0 0.5 14 -34.5 -34.0 0.5 15 -33.5 -33.0 0.5 16 -...
result:
ok OK
Extra Test:
score: 0
Extra Test Passed