結果

問題 No.607 開通777年記念
ユーザー おんぷの塊
提出日時 2025-03-27 12:57:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 1,456 bytes
コンパイル時間 4,335 ms
コンパイル使用メモリ 249,772 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-27 12:57:31
合計ジャッジ時間 5,951 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

// デバッグ用
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif

#define nall(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define YES cout << "Yes\n"
#define NO cout << "No\n"
#define YN {cout << "Yes\n";}else{cout << "No\n";}
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define PRECISION(x) cout << fixed << setprecision(x)
#define endl '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define each(o, a) for (auto &o : a)

using ll = long long; using ld = long double;
using ull = unsigned long long;
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
using vi = vc<int>; using pii = pair<int, int>; using pll = pair<ll, ll>;
using vl = vc<ll>; using vvl = vv<ll>; using vvvl = vv<vl>;
const int MOD = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n, m;
    cin >> n >> m;
    vl a(n);

    bool can = false;
    rep (i, m) {
        rep (i, n) {
            ll t; cin >> t;
            a[i] += t;
        }
        ll r = 0, sum = 0;
        rep (l, n) {
            while (r < n && sum < 777) {
                sum += a[r];
                r++;
            } 
            if (sum == 777) can = true;
            sum -= a[l];
        }
    }

    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0; 
}
0