結果

問題 No.1256 連続整数列
ユーザー Example0911Example0911
提出日時 2020-10-16 21:25:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 208,724 KB
実行使用メモリ 16,592 KB
最終ジャッジ日時 2023-09-28 06:50:36
合計ジャッジ時間 3,925 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,292 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 26 ms
10,420 KB
testcase_07 AC 27 ms
10,724 KB
testcase_08 AC 28 ms
10,908 KB
testcase_09 AC 50 ms
16,228 KB
testcase_10 WA -
testcase_11 AC 26 ms
10,268 KB
testcase_12 AC 28 ms
10,940 KB
testcase_13 WA -
testcase_14 AC 27 ms
10,508 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 33 ms
11,860 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

//#define int long long
#define ll long long
ll INF = (1LL << 60);
constexpr int mod = 1000000007;
using P = pair<int, int>;

signed main() {
	ll a; cin >> a;
	vector<ll>tmp(100020);
	for (int i = 0; i < 100010; i++) {
		tmp[i + 1] = tmp[i] + (i + 1);
	}
	map<ll, int>mp;
	for (int i = 0; i <= 100010; i++) {
		mp[tmp[i]] = i + 1;
	}
	for (int i = 0; i <= 100010; i++) {
		int idx = mp[tmp[i] + a] - 1;
		if (idx >= 0) {
			if (idx - i >= 3) {
				cout << "YES" << endl; return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0