結果
問題 | No.1218 Something Like a Theorem |
ユーザー |
![]() |
提出日時 | 2020-09-04 21:35:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 858 bytes |
コンパイル時間 | 1,783 ms |
コンパイル使用メモリ | 174,756 KB |
実行使用メモリ | 17,936 KB |
最終ジャッジ日時 | 2024-11-26 12:08:07 |
合計ジャッジ時間 | 2,873 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
#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;}