結果
| 問題 |
No.607 開通777年記念
|
| コンテスト | |
| ユーザー |
iqueue02
|
| 提出日時 | 2019-10-26 15:37:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 288 ms / 2,000 ms |
| コード長 | 770 bytes |
| コンパイル時間 | 1,637 ms |
| コンパイル使用メモリ | 171,440 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2024-09-14 09:27:24 |
| 合計ジャッジ時間 | 3,491 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
int main(){
int n, m;
cin >> n >> m;
vector<vector<int>> num(m,vector<int>(n,0));
rep(i,m) rep(j,n) cin >> num[i][j];
for (int i = 1; i < m; i++) rep(j,n) num[i][j] += num[i-1][j];
rep(i,m) rep(j,n-1) num[i][j+1] += num[i][j];
bool ok = false;
rep(i,m) {
rep(j,n) {
int v = num[i][j] - 777;
if (v < 0) continue;
if (v == 0) ok = true;
int itr = lower_bound(num[i].begin(), num[i].end(), v) - num[i].begin();
if (itr != j && num[i][j] - num[i][itr] == 777) ok = true;
}
}
if (ok) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
iqueue02