結果
問題 | No.800 四平方定理 |
ユーザー | ahe100 |
提出日時 | 2019-03-17 22:35:36 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 984 bytes |
コンパイル時間 | 1,998 ms |
コンパイル使用メモリ | 71,428 KB |
実行使用メモリ | 128,428 KB |
最終ジャッジ日時 | 2023-09-22 08:25:10 |
合計ジャッジ時間 | 5,436 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,368 KB |
testcase_01 | AC | 4 ms
11,460 KB |
testcase_02 | AC | 3 ms
7,496 KB |
testcase_03 | AC | 3 ms
7,436 KB |
testcase_04 | AC | 3 ms
7,440 KB |
testcase_05 | AC | 3 ms
7,476 KB |
testcase_06 | AC | 5 ms
11,464 KB |
testcase_07 | AC | 3 ms
9,512 KB |
testcase_08 | AC | 4 ms
11,536 KB |
testcase_09 | AC | 4 ms
11,532 KB |
testcase_10 | AC | 72 ms
67,048 KB |
testcase_11 | WA | - |
testcase_12 | AC | 79 ms
73,796 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 78 ms
77,292 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 83 ms
77,080 KB |
testcase_19 | AC | 80 ms
77,072 KB |
testcase_20 | AC | 3 ms
7,432 KB |
testcase_21 | AC | 2 ms
7,384 KB |
testcase_22 | AC | 81 ms
77,012 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 2 ms
7,384 KB |
testcase_27 | AC | 2 ms
7,456 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
ソースコード
#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,p[8000000],m[8000000]; // 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+4000000]++; } } reg(i,2,2*n*n){ ans+=p[i]*m[i-d+4000000]; } cout<<ans<<endl; return 0; }