結果

問題 No.607 開通777年記念
ユーザー rodearodea
提出日時 2018-02-22 19:56:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 65,192 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 08:25:37
合計ジャッジ時間 1,864 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 13 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 4 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 207 ms
6,944 KB
testcase_12 AC 215 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

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