QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#795183 | #9804. Guess the Polygon | ucup-team3734# | WA | 18ms | 11836kb | Python3 | 912b | 2024-11-30 18:24:17 | 2024-11-30 18:24:17 |
Judging History
answer
import sys
from fractions import Fraction
def ask(x: Fraction):
print('?', x.numerator, x.denominator)
sys.stdout.flush()
p, q = map(int, input().split())
return Fraction(p, q)
def solve():
try:
n = int(input())
pts = []
for i in range(n):
x, y = map(int, input().split())
pts.append((Fraction(x), Fraction(y)))
pts = list(sorted(pts))
answers = [Fraction(0) for _ in range(n)]
for i in range(1, n - 1):
answers[i] = ask(pts[i][0])
S = Fraction(0)
for i in range(0, n - 1):
S += (pts[i + 1][0] - pts[i][0]) * (answers[i] + answers[i + 1])
S /= 2
print('!', S.numerator, S.denominator)
sys.stdout.flush()
except:
pass
if __name__ == "__main__":
t = int(input())
for _ in range(t):
solve()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 11836kb
input:
2 4 3 0 1 3 1 1 0 0 2 1 2 1 3 0 0 999 1000 1000 999 1999 1000
output:
? 1 1 ? 1 1 ! 3 1 ? 999 1 ! 1999 2
result:
ok correct! (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 18ms
memory: 11780kb
input:
9 4 1 1 1 3 3 0 0 0 3 1 3 1
output:
? 1 1 ? 1 1 ! 9 2
result:
wrong answer the answer is incorrect, expect: 5/2, find: 9/2 (test case 1)