結果

問題 No.1605 Matrix Shape
ユーザー とりゐとりゐ
提出日時 2021-07-16 21:37:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 82,108 KB
最終ジャッジ日時 2023-09-20 13:18:20
合計ジャッジ時間 8,176 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
79,848 KB
testcase_01 AC 103 ms
79,940 KB
testcase_02 AC 101 ms
80,136 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 102 ms
80,216 KB
testcase_06 WA -
testcase_07 AC 102 ms
80,152 KB
testcase_08 WA -
testcase_09 AC 101 ms
79,796 KB
testcase_10 AC 103 ms
79,888 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 103 ms
80,008 KB
testcase_14 AC 103 ms
79,856 KB
testcase_15 AC 103 ms
79,944 KB
testcase_16 AC 103 ms
79,876 KB
testcase_17 AC 104 ms
79,844 KB
testcase_18 AC 105 ms
80,040 KB
testcase_19 AC 242 ms
81,256 KB
testcase_20 WA -
testcase_21 AC 233 ms
81,024 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 238 ms
80,928 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 204 ms
81,004 KB
testcase_28 WA -
testcase_29 AC 207 ms
80,992 KB
testcase_30 WA -
testcase_31 AC 237 ms
80,928 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 215 ms
80,816 KB
testcase_36 AC 179 ms
80,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
from collections import deque,Counter
#sys.setrecursionlimit(10**7)
int1=lambda x: int(x)-1

inp=lambda :int(input())
mi=lambda :map(int,input().split())
li=lambda :list(mi())
mi1=lambda :map(int1,input().split())
li1=lambda :list(mi1())
mis=lambda :map(str,input().split())
lis=lambda :list(mis())
pr=print

from collections import defaultdict
"""
#初期値 0
d=defaultdict(int)

#初期値 1
d=defaultdict(lambda:1)
"""

mod=10**9+7
Mod=998244353
INF=10**18
ans=0

n=inp()
h=[0]*200001
w=[0]*200001
for i in range(n):
  a,b=mi()
  h[a]+=1
  w[b]+=1
x=0
for i in range(200001):
  if h[i]!=w[i]:
    x+=1
if x==2:
  print(1)
elif x==0:
  print(n)
else:
  print(0)
0