結果
問題 | No.607 開通777年記念 |
ユーザー |
|
提出日時 | 2023-02-22 22:47:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 1,892 bytes |
コンパイル時間 | 1,791 ms |
コンパイル使用メモリ | 173,444 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-07-22 23:09:43 |
合計ジャッジ時間 | 2,602 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using vi = vector<int>;using vll = vector<ll>;using vvi = vector<vi>;using vvll = vector<vll>;using vvvll = vector<vvll>;using vs = vector<string>;const int IntINF = 1 << 30;const ll LLINF = 1LL << 60;#define REP(i, a, n) for (ll i = (a); i < (ll)(n); ++i)#define rep(i, n) REP(i, 0, n)#define what_is(x) cerr << #x << " is " << x << endl;template <typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2> &p) {os << p.first << " " << p.second;return os;}template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {rep(i, v.size()) { os << v[i] << (i < (ll)v.size() - 1 ? " " : ""); }return os;}template <typename T>ostream &operator<<(ostream &os, const vector<vector<T>> &v) {rep(i, v.size()) {rep(j, v[i].size()) {os << v[i][j] << (j < (ll)v[i].size() - 1 ? " " : "");}os << endl;}return os;}template <typename T, typename U>ostream &operator<<(ostream &os, const map<T, U> &v) {for (const auto &p : v) {os << p.first << ": " << p.second << endl;}return os;}inline void io_setup(int precision = 15) {cin.tie(nullptr);ios::sync_with_stdio(false);cout << fixed << setprecision(precision);cerr << fixed << setprecision(precision);}int main() {io_setup();int N, M;cin >> N >> M;vvll A(M, vll(N));rep(i, M) rep(j, N) cin >> A[i][j];REP(i, 1, M) {rep(j, N) { A[i][j] += A[i - 1][j]; }}vvll sum(M, vll(N + 1));rep(i, M) {rep(j, N) { sum[i][j + 1] = sum[i][j] + A[i][j]; }}rep(i, M) {rep(j, N + 1) {auto l_iter = sum[i].begin() + j;bool found = binary_search(l_iter, sum[i].end(), 777 + sum[i][j]);if (found) {cout << "YES" << endl;return 0;}}}cout << "NO" << endl;return 0;}