結果
問題 | No.800 四平方定理 |
ユーザー | ahe100 |
提出日時 | 2019-03-17 22:32:42 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 943 bytes |
コンパイル時間 | 675 ms |
コンパイル使用メモリ | 79,304 KB |
実行使用メモリ | 101,976 KB |
最終ジャッジ日時 | 2023-09-22 08:12:56 |
合計ジャッジ時間 | 5,903 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
18,692 KB |
testcase_01 | AC | 111 ms
23,152 KB |
testcase_02 | AC | 75 ms
17,560 KB |
testcase_03 | AC | 86 ms
19,496 KB |
testcase_04 | AC | 70 ms
16,604 KB |
testcase_05 | AC | 83 ms
18,504 KB |
testcase_06 | AC | 144 ms
27,440 KB |
testcase_07 | AC | 105 ms
20,824 KB |
testcase_08 | AC | 152 ms
28,976 KB |
testcase_09 | AC | 118 ms
24,148 KB |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
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<cstdio> #include<cstring> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<cmath> #include<climits> #include<string> #include<set> #include<numeric> #include<map> #include<iostream> using namespace std; #define rep(i,n) for(int i = 0;i<((int)(n));i++) #define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++) #define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--) #define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--) typedef long long ll; typedef pair<ll, ll> mp; ll mod = 1e9+7; //LLONG_MIN /* */ ll n,d,ans=0; map<ll,ll> p,m; int main(void){ cin>>n>>d; // reg(x,1,n){ // reg(y,1,n){ // reg(z,1,n){ // reg(w,1,n){ // if(x*x + y*y + z*z == w*w +d){ // printf("%d,%d,%d,%d,\n",x,y,z,w); // } // } // } // } // } reg(x,1,n){ reg(y,1,n){ p[x*x + y*y]++; m[x*x - y*y]++; } } reg(i,2,2*n*n){ ans+=p[i]*m[i-d]; } cout<<ans<<endl; return 0; }