結果

問題 No.607 開通777年記念
ユーザー glretoglreto
提出日時 2021-05-12 18:24:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 1,327 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 115,244 KB
実行使用メモリ 7,616 KB
最終ジャッジ日時 2023-10-24 11:09:11
合計ジャッジ時間 2,952 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<map>
#include<random>
#include<complex>
#include<math.h>
#include<functional>
#include<stack>
#include<queue>
#include<unordered_map>
#include<set>
#include<numeric>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int inf = 0x3fffffff;
const ll INF = 1e18;
int main() {
	int h, w; cin >> w >> h; vector<vector<int>>  a(h+1, vector<int>(w+1));
	rep(i, h) rep(j, w) cin >> a[i][j];
	rep(i, h) rep(j, w) a[i][j + 1] += a[i][j];
	rep(i, h ) rep(j, w) a[i + 1][j] += a[i][j];
	rep(i, h) rep(j, w) {
		int d = a[i][j] - 777;
		if (d < 0)continue;
		if (d == 0) {
			cout << "YES" << endl;
			return 0;
		}int k = lower_bound(a[i].begin(), a[i].begin() + j, d) - a[i].begin();
		if (k != j && a[i][j] - a[i][k] == 777) {
			cout << "YES" << endl;
			return 0;
		}
	}cout << "NO" << endl;
}
0