結果

問題 No.800 四平方定理
ユーザー PachicobuePachicobue
提出日時 2019-03-17 21:35:26
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,563 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 115,896 KB
実行使用メモリ 130,764 KB
最終ジャッジ日時 2023-08-20 12:04:24
合計ジャッジ時間 27,038 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
9,376 KB
testcase_01 AC 15 ms
5,984 KB
testcase_02 AC 11 ms
5,168 KB
testcase_03 AC 12 ms
5,220 KB
testcase_04 AC 11 ms
5,116 KB
testcase_05 AC 12 ms
5,200 KB
testcase_06 AC 20 ms
6,752 KB
testcase_07 AC 14 ms
5,776 KB
testcase_08 AC 21 ms
6,760 KB
testcase_09 AC 17 ms
6,584 KB
testcase_10 AC 1,721 ms
69,372 KB
testcase_11 AC 1,964 ms
75,288 KB
testcase_12 AC 1,908 ms
74,496 KB
testcase_13 AC 1,835 ms
71,616 KB
testcase_14 AC 1,960 ms
75,456 KB
testcase_15 AC 1,946 ms
75,100 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 1,995 ms
75,668 KB
testcase_19 TLE -
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wsign-conversion"
using ld = long double;
using ll = long long;
//!============================================!//
//!    8888ba.88ba             oo              !//
//!    88  '8b  '8b                            !//
//!    88   88   88  .d8888b.  dP  88d888b.    !//
//!    88   88   88  88'  '88  88  88'  '88    !//
//!    88   88   88  88.  .88  88  88    88    !//
//!    dP   dP   dP  '88888P8  dP  dP    dP    !//
//!============================================!//
int main()
{
    int N, D;
    std::cin >> N >> D;
    std::unordered_map<int, int> wa, sa;
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) { wa[i * i + j * j]++, sa[i * i - j * j]++; }
    }
    ll ans = 0;
    for (const auto& p : sa) {
        const int W = D + p.first;
        if (wa.find(W) != wa.end()) { ans += p.second * wa[W]; }
    }
    std::cout << ans << std::endl;
    return 0;
}
0