QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#680418#8209. Curly PalindromesLokeCompile Error//C++14742b2024-10-26 20:59:592024-10-26 21:00:00

Judging History

This is the latest submission verdict.

  • [2024-10-26 21:00:00]
  • Judged
  • [2024-10-26 20:59:59]
  • Submitted

answer

from math import gcd
N = int(input())
X = []
Y = []
C = []
for _ in range(N):
    x,y,c = input().split()
    X.append(int(x))
    Y.append(int(y))
    C.append(c)

Xn = [X[i]-X[0] for i in range(1, N)]
Yn = [Y[i]-Y[0] for i in range(1, N)]
for i in range(N-1):
    d = gcd(Xn[i], Yn[i])
    Xn[i] //= d
    Yn[i] //= d
    if Xn[i] < 0 or (Xn[i] == 0 and Yn[i] < 0):
        Xn[i] *= -1
        Yn[i] *= -1
all_colinear = (len(set(zip(Xn, Yn))) == 1)

if N == 1:
    print(1)
elif N == 2:
    print(1 + C[0]==C[1])
elif len(set(C)) == len(C):
    # all labels unique
    print(1)
else:
    # some duplicate label
    # >= 3 points
    if all_colinear:
        print(2)
    else:
        print("Infinity")

详细

answer.code:28:7: error: invalid preprocessing directive #all
   28 |     # all labels unique
      |       ^~~
answer.code:31:7: error: invalid preprocessing directive #some
   31 |     # some duplicate label
      |       ^~~~
answer.code:32:7: error: invalid preprocessing directive #>=
   32 |     # >= 3 points
      |       ^~
answer.code:1:1: error: ‘from’ does not name a type
    1 | from math import gcd
      | ^~~~