結果
| 問題 |
No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
|
| コンテスト | |
| ユーザー |
dn6049949
|
| 提出日時 | 2021-11-14 21:27:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 835 bytes |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 82,696 KB |
| 実行使用メモリ | 86,064 KB |
| 最終ジャッジ日時 | 2024-11-30 06:26:16 |
| 合計ジャッジ時間 | 4,381 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 22 |
ソースコード
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def IR(n):
return [I() for _ in range(n)]
def LIR(n):
return [LI() for _ in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007
def main():
n,m,l = LI()
st = LIR(l)
fs = [0]*(n+1)
ft = [0]*(m+1)
for s,t in st:
fs[s] += 1
ft[t] += 1
a = sum(i>=1 for i in fs)
b = sum(i>=1 for i in ft)
m = min(a,b)
for s,t in st:
a_ = a-(fs[s]==1)
b_ = b-(ft[t]==1)
m_ = min(a_,b_)
print(["Yes","No"][m != m_])
return
if __name__ == "__main__":
main()
dn6049949