結果
問題 | No.607 開通777年記念 |
ユーザー |
|
提出日時 | 2024-12-25 18:28:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 229 ms / 2,000 ms |
コード長 | 1,012 bytes |
コンパイル時間 | 1,977 ms |
コンパイル使用メモリ | 196,248 KB |
最終ジャッジ日時 | 2025-02-26 16:46:13 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i,a,n) for(int i=a; i<(n); i++)#define rrep(i,a,b) for(int i=a;i>=b;i--)#define fore(i,a) for(auto i:a)#define all(a) a.begin(),a.end()#define rall(a) a.rbegin(),a.rend()using Int = long long;const Int INF = 1LL << 60;const int inf = 1001001001;vector<int> dxs = {1, 0, -1, 0};vector<int> dys = {0, 1, 0, -1};struct Edge{Int to, w;Edge(Int to, Int w) : to(to), w(w) {}};int main(){int n,m;cin>>n>>m;vector<int> sum(n,0);rep(i,0,m){rep(j,0,n){int a;cin>>a;sum[j]+=a;}int right=0;int cnt=sum[0];bool ok=false;rep(left,0,n){while(cnt<777&&right<n-1){right++;cnt+=sum[right];}if(cnt==777)ok=true;cnt-=sum[left];}if(ok){cout<<"YES"<<endl;return 0;}}cout<<"NO"<<endl;return 0;}