結果

問題 No.607 開通777年記念
ユーザー pluto77pluto77
提出日時 2017-12-30 15:57:03
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,400 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 6,720 KB
実行使用メモリ 38,512 KB
最終ジャッジ日時 2023-08-23 11:02:49
合計ジャッジ時間 4,498 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,040 KB
testcase_01 AC 11 ms
5,864 KB
testcase_02 AC 11 ms
5,980 KB
testcase_03 AC 11 ms
5,924 KB
testcase_04 AC 12 ms
5,812 KB
testcase_05 AC 11 ms
5,860 KB
testcase_06 AC 11 ms
5,804 KB
testcase_07 AC 768 ms
7,936 KB
testcase_08 AC 12 ms
5,932 KB
testcase_09 AC 25 ms
6,272 KB
testcase_10 AC 16 ms
6,336 KB
testcase_11 AC 1,313 ms
38,512 KB
testcase_12 AC 1,400 ms
38,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_607
import sys

n,m=map(int,raw_input().split())
a=[]
for i in xrange(m):
 b=map(int,raw_input().split())
 a.append(b)
c=a[0]
l,r=0,1
for i in range(n*2):
 s=sum(c[l:r])
 if s==777:
  print 'YES'
  exit()
 elif s<777:
  r+=1
 else:
  l+=1
 if r>n:
  continue
for i in xrange(1,m):
 for j in xrange(n):
  c[j]+=a[i][j]
 l,r=0,1
 for i in range(n*2):
  s=sum(c[l:r])
  if s==777:
   print 'YES'
   exit()
  elif s<777:
   r+=1
  else:
   l+=1
  if r>n:
   continue
print 'NO'
0