結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2018-10-13 17:42:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 981 ms / 2,000 ms |
コード長 | 891 bytes |
コンパイル時間 | 1,551 ms |
コンパイル使用メモリ | 158,320 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-10-12 18:08:28 |
合計ジャッジ時間 | 4,882 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <iostream>#include <vector>#include <bits/stdc++.h>#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)#define REP(i, n) FOR(i, 0, n)using namespace std;int main(){// Your code hereint N,M;cin >> N>>M;int A[1000][1000];REP(i,M)REP(j,N) cin >>A[i][j];FOR(i,1,M)FOR(j,0,N) A[i][j]+=A[i-1][j];FOR(i,0,M)FOR(j,1,N) A[i][j]+=A[i][j-1];REP(i,M){REP(j,N){if(A[i][j]==777){cout <<"YES"<<endl;return 0;}else if(A[i][j]<777){continue;}else{REP(k,N){int b = A[i][j]-A[i][k];if (b==777){cout <<"YES"<<endl;return 0;}}}}}cout << "NO"<<endl;}