結果
問題 | No.2392 二平方和 |
ユーザー |
![]() |
提出日時 | 2024-12-07 18:57:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 2,015 ms |
コンパイル使用メモリ | 95,592 KB |
実行使用メモリ | 11,620 KB |
最終ジャッジ日時 | 2024-12-07 18:57:41 |
合計ジャッジ時間 | 2,441 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
#include <algorithm>#include <iostream>#include <vector>// #include <bits/stdc++.h>#define int long longstd::vector<int> pre;void solve() {int x;std::cin >> x;// x = x * 4 + 2;for (int i = 0; i < pre.size(); i++) {int v = pre[i];// for (auto v : pre) {if (v + v > x) break;int vv = x - v;if (*std::lower_bound(pre.begin(), pre.end(), vv) == vv) {// std::cout << v << ' ' << vv << '\n';std::cout << "Yes\n";return;// return 1;}}// return 0;std::cout << "No\n";}signed main() {std::cin.tie(0)->sync_with_stdio(false);for (int i = 1; i * i <= 1e12; i += 1) {pre.push_back(i * i);}int t = 1;// std::cin >> t;while (t--) {solve();}return 0;}