結果

問題 No.1218 Something Like a Theorem
ユーザー Example0911Example0911
提出日時 2020-09-04 21:35:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 858 bytes
コンパイル時間 1,900 ms
コンパイル使用メモリ 173,024 KB
実行使用メモリ 16,728 KB
最終ジャッジ日時 2023-08-17 15:07:49
合計ジャッジ時間 2,785 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
16,656 KB
testcase_01 AC 3 ms
4,644 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 56 ms
16,660 KB
testcase_07 AC 56 ms
16,660 KB
testcase_08 AC 54 ms
16,660 KB
testcase_09 AC 54 ms
16,728 KB
testcase_10 AC 54 ms
16,664 KB
testcase_11 AC 55 ms
16,696 KB
testcase_12 AC 57 ms
16,672 KB
testcase_13 AC 3 ms
4,468 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
long long rui[1000010];
map<long long, bool>tmp;
signed main() {
	long long n, z; cin >> n >> z;
	bool ok = false;
	if (n == 1) {
		if (z != 1)ok = true;
	}
	else {
		
		for (long long x = 1; x <= 100005; x++) {
			long long now = 1;
			bool ok2 = true;
			for (long long i = 0; i < n; i++) {
				now *= x;
				if (now >= (long long)(1e10)) {
					ok2 = false;
					break;
				}
			}
			if (ok2) {
				rui[x] = now;
			}
			else {
				rui[x] = 100100100;
			}
		}
		for (int x = 1; x <= 100004; x++) {
			if(rui[x] != 100100100 && rui[z]!=100100100 && rui[z] - rui[x] != 0)tmp[rui[z] - rui[x]] = true;
		}
		for (int x = 1; x <= 100004; x++) {
			if (rui[x] != 100100100 && tmp[rui[x]]) {
				//cout << x << endl;
				ok = true;
			}
		}
	}
	if (ok)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}
0