結果
問題 | No.800 四平方定理 |
ユーザー | T1610 |
提出日時 | 2019-03-17 21:26:31 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 838 bytes |
コンパイル時間 | 1,709 ms |
コンパイル使用メモリ | 173,780 KB |
実行使用メモリ | 43,784 KB |
最終ジャッジ日時 | 2023-09-22 03:34:18 |
合計ジャッジ時間 | 8,704 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
8,764 KB |
testcase_01 | AC | 22 ms
4,924 KB |
testcase_02 | AC | 15 ms
4,440 KB |
testcase_03 | AC | 17 ms
4,528 KB |
testcase_04 | AC | 15 ms
4,380 KB |
testcase_05 | AC | 17 ms
4,484 KB |
testcase_06 | AC | 26 ms
5,384 KB |
testcase_07 | AC | 21 ms
4,760 KB |
testcase_08 | AC | 20 ms
5,192 KB |
testcase_09 | AC | 22 ms
4,964 KB |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define repr(i, n) REPR(i, n, 0) #define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--) #define pb push_back #define all(r) r.begin(),r.end() #define rall(r) r.rbegin(),r.rend() #define fi first #define se second typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll MOD = 1e9 + 7; double EPS = 1e-8; int main(){ ll n, d; cin >> n >> d; map<ll, ll> mp; REP(x, 1, n+1) REP(y, 1, n+1) ++mp[(ll)x*x+(ll)y*y]; ll ans = 0LL; REP(z, 1, n+1) REP(w, 1, n+1) { ll xy = (ll)w*w+d-ll(z*z); if(mp.count(xy)) ans+=mp[xy]; } cout << ans << '\n'; return 0; }