結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2018-11-29 15:15:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 274 ms / 2,000 ms |
コード長 | 756 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 66,632 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-06-26 23:02:07 |
合計ジャッジ時間 | 2,312 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>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];}}vector<int> now(N);vector<int> s(N + 2);s[0] = 0;s[N + 1] = 1100000000;for (int i = 0; i < M; i++) {for (int j = 0; j < N; j++) {now[j] += a[i][j];}for (int j = 0; j < N; j++) {s[j + 1] = s[j] + now[j];}for (int j = 0; j <= N; j++) {auto itr = lower_bound(s.begin(), s.end(), 777 + s[j]);if (*itr == 777 + s[j]) {cout << "YES" << endl;return 0;}}}cout << "NO" << endl;return 0;}