結果

問題 No.607 開通777年記念
ユーザー matsukin1111matsukin1111
提出日時 2019-04-03 23:25:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 1,305 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 7,688 KB
最終ジャッジ日時 2023-08-25 01:09:27
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,368 KB
testcase_01 AC 4 ms
7,564 KB
testcase_02 AC 4 ms
7,420 KB
testcase_03 AC 4 ms
7,424 KB
testcase_04 AC 4 ms
7,352 KB
testcase_05 AC 5 ms
7,440 KB
testcase_06 AC 5 ms
7,688 KB
testcase_07 AC 38 ms
7,416 KB
testcase_08 AC 4 ms
7,480 KB
testcase_09 AC 6 ms
7,480 KB
testcase_10 AC 6 ms
7,496 KB
testcase_11 AC 207 ms
7,436 KB
testcase_12 AC 190 ms
7,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };



int main(){
	int n, m;
	cin >> n >> m;

	vector<vector<int>>a(1010,vector<int>(1010,0));

	rep(i, 0, m)rep(j, 0, n) {
		cin >> a[i][j];
	}

	rep(i, 0, m)rep(j, 0, n) {
		if (i == 0) {
			continue;
		}
		else {
			a[i][j] += a[i - 1][j];
		}
	}

	rep(i, 0, m) {
		int ok = 0;
		int right = 0;
		int sum = 0;
		rep(left, 0, n) {
			while (right < n && sum + a[i][right] < 777) {
				sum += a[i][right];
				++right;
			}
			if (sum + a[i][right] == 777) {
				cout << "YES" << endl;
				return 0;
			}
			if (right == left)++right;
			else sum -= a[i][left];
		}
	}
	cout << "NO" << endl;


	return 0;
}
0