結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2020-09-29 22:19:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 435 bytes |
| コンパイル時間 | 1,541 ms |
| コンパイル使用メモリ | 172,752 KB |
| 実行使用メモリ | 127,488 KB |
| 最終ジャッジ日時 | 2024-07-04 14:30:39 |
| 合計ジャッジ時間 | 24,504 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 TLE * 1 -- * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000
#define MOD 1000000007
using ll=long long;
using Graph=vector<vector<int>>;
int main(){
int N,D;
cin>>N>>D;
map<int,int> m;
for(int i=1;i<=N;i++){
m[i*i*2]++;
for(int j=i+1;j<=N;j++){
m[i*i+j*j]+=2;
}
}
int ans=0;
for(int i=1;i<=N;i++){
for(int j=1;j<=N;j++){
ans+=m[i*i-j*j+D];
}
}
cout<<ans<<endl;
}
monnu