結果

問題 No.607 開通777年記念
ユーザー ldsybldsyb
提出日時 2017-12-12 22:33:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 821 bytes
コンパイル時間 1,555 ms
コンパイル使用メモリ 170,124 KB
実行使用メモリ 7,588 KB
最終ジャッジ日時 2023-08-20 23:36:54
合計ジャッジ時間 2,950 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 38 ms
4,536 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 313 ms
7,312 KB
testcase_12 AC 309 ms
7,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> a(m, vector<int>(n));
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 1; i < m; i++) {
		for (int j = 0; j < n; j++) {
			a[i][j] += a[i - 1][j];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 1; j < n; j++) {
			a[i][j] += a[i][j - 1];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			int num = max(
							upper_bound(a[i].begin(), a[i].end(), a[i][j] - 777) - lower_bound(a[i].begin(), a[i].end(), a[i][j] - 777),
							upper_bound(a[i].begin(), a[i].end(), 777) - lower_bound(a[i].begin(), a[i].end(), 777)
							);
			if (0 < num) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0