結果

問題 No.2684 折々の色
ユーザー katonyonkokatonyonko
提出日時 2024-03-20 23:52:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,252 ms / 2,000 ms
コード長 2,015 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 277,788 KB
最終ジャッジ日時 2024-03-20 23:53:29
合計ジャッジ時間 35,355 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,600 KB
testcase_01 AC 44 ms
55,600 KB
testcase_02 AC 52 ms
63,012 KB
testcase_03 AC 45 ms
55,600 KB
testcase_04 AC 51 ms
63,012 KB
testcase_05 AC 45 ms
55,600 KB
testcase_06 AC 46 ms
57,688 KB
testcase_07 AC 45 ms
55,600 KB
testcase_08 AC 51 ms
63,016 KB
testcase_09 AC 47 ms
57,688 KB
testcase_10 AC 47 ms
57,688 KB
testcase_11 AC 618 ms
158,944 KB
testcase_12 AC 431 ms
125,756 KB
testcase_13 AC 715 ms
170,932 KB
testcase_14 AC 400 ms
122,024 KB
testcase_15 AC 499 ms
133,820 KB
testcase_16 AC 198 ms
87,968 KB
testcase_17 AC 414 ms
119,064 KB
testcase_18 AC 656 ms
161,240 KB
testcase_19 AC 705 ms
168,228 KB
testcase_20 AC 498 ms
144,496 KB
testcase_21 AC 262 ms
98,560 KB
testcase_22 AC 767 ms
183,152 KB
testcase_23 AC 559 ms
152,856 KB
testcase_24 AC 346 ms
108,224 KB
testcase_25 AC 425 ms
126,096 KB
testcase_26 AC 697 ms
179,612 KB
testcase_27 AC 469 ms
133,832 KB
testcase_28 AC 538 ms
152,460 KB
testcase_29 AC 991 ms
240,180 KB
testcase_30 AC 934 ms
227,012 KB
testcase_31 AC 1,108 ms
255,620 KB
testcase_32 AC 1,182 ms
264,568 KB
testcase_33 AC 912 ms
217,592 KB
testcase_34 AC 989 ms
240,912 KB
testcase_35 AC 968 ms
237,092 KB
testcase_36 AC 1,043 ms
247,464 KB
testcase_37 AC 1,010 ms
235,664 KB
testcase_38 AC 1,249 ms
277,788 KB
testcase_39 AC 1,243 ms
276,460 KB
testcase_40 AC 1,212 ms
276,424 KB
testcase_41 AC 1,206 ms
275,604 KB
testcase_42 AC 1,208 ms
275,616 KB
testcase_43 AC 1,252 ms
275,652 KB
testcase_44 AC 1,227 ms
276,456 KB
testcase_45 AC 1,222 ms
276,592 KB
testcase_46 AC 1,222 ms
276,420 KB
testcase_47 AC 45 ms
55,600 KB
testcase_48 AC 45 ms
55,600 KB
testcase_49 AC 45 ms
55,600 KB
testcase_50 AC 45 ms
55,600 KB
testcase_51 AC 46 ms
55,600 KB
testcase_52 AC 45 ms
55,600 KB
testcase_53 AC 46 ms
55,600 KB
testcase_54 AC 46 ms
57,688 KB
testcase_55 AC 46 ms
55,600 KB
testcase_56 AC 45 ms
55,600 KB
testcase_57 AC 43 ms
55,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import io
import sys
from collections import defaultdict, deque, Counter
from itertools import permutations, combinations, accumulate
from heapq import heappush, heappop
from bisect import bisect_right, bisect_left
from math import gcd
import math

_INPUT = """\
6
3 3
100 120 140
80 100 160 75
320 360 160 50
0 5 10 30
2 4
0 0 0 0
0 10 20 30 40
50 60 70 80 90
"""

def solve(test):
  N,M=map(int,input().split())
  X=list(map(int,input().split()))
  C=[list(map(int,input().split())) for _ in range(N)]
  s=set()
  ans='No'
  for i in range(N):
    tmp=[]
    if C[i][-1]==100:
      if C[i][:M]==X:
        ans='Yes'
        break
    else:
      for j in range(M):
        if (10000*X[j]-100*C[i][-1]*C[i][j])%(100-C[i][-1])==0:
          tmp.append((10000*X[j]-100*C[i][-1]*C[i][j])//(100-C[i][-1]))
      if tuple(tmp) in s:
        ans='Yes'
        break
    s.add(tuple([C[i][-1]*C[i][j] for j in range(M)]))
  s=set()
  for i in reversed(range(N)):
    tmp=[]
    if C[i][-1]!=100:
      for j in range(M):
        if (10000*X[j]-100*C[i][-1]*C[i][j])%(100-C[i][-1])==0:
          tmp.append((10000*X[j]-100*C[i][-1]*C[i][j])//(100-C[i][-1]))
      if tuple(tmp) in s:
        ans='Yes'
        break
    s.add(tuple([C[i][-1]*C[i][j] for j in range(M)]))
  print(ans)

def random_input():
  from random import randint,shuffle
  N=randint(1,10)
  M=randint(1,N)
  A=list(range(1,M+1))+[randint(1,M) for _ in range(N-M)]
  shuffle(A)
  return (" ".join(map(str, [N,M]))+"\n"+" ".join(map(str, A))+"\n")*3

def simple_solve():
  return []

def main(test):
  if test==0:
    solve(0)
  elif test==1:
    sys.stdin = io.StringIO(_INPUT)
    case_no=int(input())
    for _ in range(case_no):
      solve(0)
  else:
    for i in range(1000):
      sys.stdin = io.StringIO(random_input())
      x=solve(1)
      y=simple_solve()
      if x!=y:
        print(i,x,y)
        print(*[line for line in sys.stdin],sep='')
        break

#0:提出用、1:与えられたテスト用、2:ストレステスト用
main(0)
0