結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2017-12-12 22:33:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 344 ms / 2,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 1,772 ms |
コンパイル使用メモリ | 173,804 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-12-14 06:30:58 |
合計ジャッジ時間 | 3,157 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int n, m;cin >> n >> m;vector<vector<int>> a(m, vector<int>(n));for (int i = 0; i < m; i++) {for (int j = 0; j < n; j++) {cin >> a[i][j];}}for (int i = 1; i < m; i++) {for (int j = 0; j < n; j++) {a[i][j] += a[i - 1][j];}}for (int i = 0; i < m; i++) {for (int j = 1; j < n; j++) {a[i][j] += a[i][j - 1];}}for (int i = 0; i < m; i++) {for (int j = 0; j < n; j++) {int num = max(upper_bound(a[i].begin(), a[i].end(), a[i][j] - 777) - lower_bound(a[i].begin(), a[i].end(), a[i][j] - 777),upper_bound(a[i].begin(), a[i].end(), 777) - lower_bound(a[i].begin(), a[i].end(), 777));if (0 < num) {cout << "YES" << endl;return 0;}}}cout << "NO" << endl;return 0;}