結果
| 問題 | No.3622 Perfect Matching of Crab |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-08-15 01:16:46 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 478 ms / 2,000 ms |
| + 997µs | |
| コード長 | 1,144 bytes |
| 記録 | |
| コンパイル時間 | 648 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 19,132 KB |
| 最終ジャッジ日時 | 2026-10-25 08:16:07 |
| 合計ジャッジ時間 | 9,951 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
import sys
input = sys.stdin.readline
T=int(input())
for tests in range(T):
N=int(input())
X=[]
Y=[]
for i in range(2*N):
x,y,c=input().split()
x=int(x)
y=int(y)
if c=="x":
X.append(y)
else:
Y.append(x)
X.sort()
Y.sort()
if len(X)==len(Y):
print("Yes")
else:
if len(X)<len(Y):
k=len(Y)-len(X)
ind=0
score=0
while ind<len(Y):
if ind+1<len(Y) and Y[ind]==Y[ind+1]:
ind+=2
score+=2
continue
ind+=1
if score>=k:
print("Yes")
else:
print("No")
else:
k=len(X)-len(Y)
ind=0
score=0
while ind<len(X):
if ind+1<len(X) and X[ind]==X[ind+1]:
ind+=2
score+=2
continue
ind+=1
if score>=k:
print("Yes")
else:
print("No")
titia