結果

問題 No.607 開通777年記念
ユーザー evawenisevawenis
提出日時 2020-06-24 01:34:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 579 bytes
コンパイル時間 1,996 ms
コンパイル使用メモリ 202,660 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-16 20:25:54
合計ジャッジ時間 2,995 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	vector<int>a(n);
	bool yes=false;
	for(int i=0;i<m;++i){
		vector<int>v(n);
		for(int j=0;j<n;++j){
			int A; cin>>A;
			a.at(j)+=A;
		}
		vector<int>sum(n+1); sum.front()=0;
		for(int j=1;j<=n;++j){
			sum.at(j)=sum.at(j-1)+a.at(j-1);
		}
		int j=0,total=0;
		for(int k=1;k<=n;++k){
			total+=sum.at(k);
			while(total>777&&j<k){
				++j;
				total-=sum.at(j);
			}
			if(total==777){
				yes=true;
				break;
			}
		}
	}
	cout<<(yes?"YES"s:"NO"s)<<"\n"s;
}
0