結果

問題 No.1256 連続整数列
ユーザー Example0911Example0911
提出日時 2020-10-16 21:27:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 207,740 KB
実行使用メモリ 30,016 KB
最終ジャッジ日時 2023-09-28 06:52:45
合計ジャッジ時間 5,725 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
17,100 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 63 ms
17,236 KB
testcase_07 AC 64 ms
17,604 KB
testcase_08 AC 65 ms
17,952 KB
testcase_09 AC 120 ms
29,648 KB
testcase_10 WA -
testcase_11 AC 62 ms
17,256 KB
testcase_12 AC 65 ms
17,884 KB
testcase_13 WA -
testcase_14 AC 63 ms
17,548 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 69 ms
18,868 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(200020);
	for (int i = 0; i < 200010; i++) {
		tmp[i + 1] = tmp[i] + (i + 1);
	}
	map<ll, int>mp;
	for (int i = 0; i <= 200010; i++) {
		mp[tmp[i]] = i + 1;
	}
	for (int i = 0; i <= 200010; i++) {
		int idx = mp[tmp[i] + a] - 1;
		if (idx >= 0) {
			if (tmp[idx] - tmp[i] == a && idx - i >= 3) {
				cout << "YES" << endl; return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0