結果

問題 No.607 開通777年記念
ユーザー severrabaenseverrabaen
提出日時 2019-08-06 11:35:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 2,055 bytes
コンパイル時間 2,023 ms
コンパイル使用メモリ 202,936 KB
実行使用メモリ 7,504 KB
最終ジャッジ日時 2023-09-25 17:39:29
合計ジャッジ時間 3,298 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,376 KB
testcase_01 AC 2 ms
5,384 KB
testcase_02 AC 2 ms
5,464 KB
testcase_03 AC 2 ms
5,380 KB
testcase_04 AC 2 ms
5,348 KB
testcase_05 AC 2 ms
5,368 KB
testcase_06 AC 2 ms
5,388 KB
testcase_07 AC 37 ms
7,328 KB
testcase_08 AC 2 ms
5,436 KB
testcase_09 AC 4 ms
5,836 KB
testcase_10 AC 4 ms
5,776 KB
testcase_11 AC 208 ms
7,484 KB
testcase_12 AC 193 ms
7,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}


//↑template↑


int a, b, k[1005][1005];
int main() {
	cin >> a >> b;

	for (int i = 0; i < b; ++i) {
		for (int j = 0; j < a; ++j) {
			cin >> k[i][j];
			if (i != 0) { k[i][j] += k[i - 1][j]; }
		}
	}

	for (int i = 0; i < b; ++i) {
		int l = 0, r = 0, mon = 0;
		for (; l < a; ++l) {
			while (mon < 777) {
				if (r == a) { break; }
				mon += k[i][r];
				++r;
			}
			if (mon < 777) { break; }
			if (mon == 777) { cout << "YES" << endl; return 0; }
			mon -= k[i][l];
		}
	}

	cout << "NO" << endl;
}
0