結果

問題 No.607 開通777年記念
ユーザー seeking
提出日時 2019-11-16 14:36:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 70,704 KB
実行使用メモリ 7,388 KB
最終ジャッジ日時 2024-09-24 23:21:05
合計ジャッジ時間 2,238 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int a[1010][1010];
int now[1010];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			cin >> a[i][j];
		}
	}
	int sum = 0;
	int k = 0;
	for (int i = 0; i < M; i++) {
		k = 0; sum = 0;
		for (int j = 0; j < N; j++) {
			now[j] += a[i][j];
			sum += now[j];
			while (sum > 777) {
				sum -= now[k];
				k++;
			}
			if (sum == 777) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
}
0