結果
問題 | No.800 四平方定理 |
ユーザー | xxxasdfghjk |
提出日時 | 2019-03-20 15:26:22 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 839 bytes |
コンパイル時間 | 1,628 ms |
コンパイル使用メモリ | 167,076 KB |
実行使用メモリ | 96,500 KB |
最終ジャッジ日時 | 2023-10-19 04:25:43 |
合計ジャッジ時間 | 5,530 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
5,780 KB |
testcase_01 | AC | 34 ms
7,600 KB |
testcase_02 | AC | 22 ms
6,336 KB |
testcase_03 | AC | 26 ms
6,884 KB |
testcase_04 | AC | 21 ms
6,284 KB |
testcase_05 | AC | 25 ms
6,684 KB |
testcase_06 | AC | 43 ms
8,400 KB |
testcase_07 | AC | 29 ms
7,192 KB |
testcase_08 | AC | 39 ms
8,660 KB |
testcase_09 | AC | 34 ms
7,640 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<bits/stdc++.h> #define MAX_N 100001 #define INF_INT 2147483647 #define INF_LL 9223372036854775807 #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; typedef long long int ll; typedef pair<ll,ll> P; void init(int n); int find(int n); void unite(int x,int y); bool same(int x, int y); ll bpow(ll,ll,ll); typedef vector<int> vec; typedef vector<vec> mat; mat mul(mat &A,mat &B); mat pow(mat A,ll n); int dx[4] = {1,0,0,-1}; int dy[4] = {0,1,-1,0}; const int MOD = 1000000007; bool cmp_P(const P &a,const P &b){ return a.second < b.second; } int main() { ll res=0,N,D; cin >> N >> D; map<ll,ll> mp; for(int i=1;i<=N;i++){ for(int j=1;j<=N;j++){ mp[i*i+j*j]++; } } for(int i=1;i<=N;i++){ for(int j=1;j<=N;j++){ res += mp[D-i*i+j*j]; } } cout << res << endl; return 0; }