結果

問題 No.607 開通777年記念
ユーザー rodea
提出日時 2018-02-22 19:56:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 64,284 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-02 10:07:52
合計ジャッジ時間 2,119 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int b[1001];

int main()
{
	int n, m, a[1001], ans = 0, s = 1;

	cin >> n >> m;

	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cin >> a[j];
			
			b[j] += a[j];
		}

		for (int j = 1; j <= n; j++)
		{
			ans += b[j];

			if (ans > 777)
			{
				while (ans > 777)
				{
					ans -= b[s];
					s++;
				}
			}
			if (ans == 777)
			{
				cout << "YES" << endl;
				return 0;
			}
		}
		s = 1;
		ans = 0;
	}
	cout << "NO" << endl;
}
0