結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
sinsincoscos
|
| 提出日時 | 2019-03-17 21:42:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 420 bytes |
| コンパイル時間 | 641 ms |
| コンパイル使用メモリ | 78,908 KB |
| 実行使用メモリ | 142,048 KB |
| 最終ジャッジ日時 | 2024-07-07 21:27:46 |
| 合計ジャッジ時間 | 21,394 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 2 -- * 8 |
ソースコード
#include <iostream>
#include <unordered_map>
using namespace std;
typedef long long ll;
int N,D;
int main(){
cin >> N >> D;
unordered_map<int,ll> m1,m2;
for(int i=1;i<=N;i++){
for(int j=1;j<=N;j++){
m1[i*i+j*j]++;
m2[i*i-j*j]++;
}
}
ll ans = 0;
for(auto x:m1){
if(m2.count(D-x.first)) ans += x.second*m2[D-x.first];
}
cout << ans << endl;
}
sinsincoscos