結果
| 問題 | No.607 開通777年記念 | 
| コンテスト | |
| ユーザー |  CELICA | 
| 提出日時 | 2020-09-22 21:33:37 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 80 ms / 2,000 ms | 
| コード長 | 692 bytes | 
| コンパイル時間 | 1,705 ms | 
| コンパイル使用メモリ | 173,100 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-06-26 21:10:22 | 
| 合計ジャッジ時間 | 3,172 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin >> n >> m;
	vector<vector<ll> > v(m, vector<ll>(n));
	for (auto&& it : v)
		for (auto&& it2 : it)
			cin >> it2;
	for (int i = 0; i < m; ++i)
	{
		if (i > 0)
		{
			for (int j = 0; j < n; ++j)
				v[i][j] += v[i - 1][j];
		}
		for (int left = 0; left < n; ++left)
		{
			ll sum = 0;
			int right = left;
			while (right < n && sum + v[i][right] <= 777)
				sum += v[i][right++];
			if (sum == 777)
			{
				cout << "YES\n";
				return 0;
			}
		}
	}
	cout << "NO\n";
	return 0;
}
            
            
            
        