結果
問題 | No.800 四平方定理 |
ユーザー | asdf1 |
提出日時 | 2019-03-17 21:41:56 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,185 bytes |
コンパイル時間 | 1,268 ms |
コンパイル使用メモリ | 154,484 KB |
実行使用メモリ | 164,444 KB |
最終ジャッジ日時 | 2023-09-22 04:39:02 |
合計ジャッジ時間 | 25,489 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 7 ms
4,420 KB |
testcase_01 | AC | 14 ms
5,776 KB |
testcase_02 | AC | 11 ms
5,612 KB |
testcase_03 | AC | 13 ms
5,552 KB |
testcase_04 | AC | 9 ms
4,700 KB |
testcase_05 | AC | 12 ms
5,472 KB |
testcase_06 | AC | 17 ms
6,000 KB |
testcase_07 | AC | 13 ms
5,552 KB |
testcase_08 | AC | 18 ms
6,212 KB |
testcase_09 | AC | 15 ms
5,740 KB |
testcase_10 | AC | 1,063 ms
58,764 KB |
testcase_11 | AC | 1,386 ms
82,556 KB |
testcase_12 | AC | 1,375 ms
82,460 KB |
testcase_13 | AC | 1,338 ms
82,600 KB |
testcase_14 | AC | 1,410 ms
82,548 KB |
testcase_15 | AC | 1,402 ms
82,556 KB |
testcase_16 | AC | 1,455 ms
82,564 KB |
testcase_17 | AC | 1,431 ms
82,540 KB |
testcase_18 | AC | 1,427 ms
82,612 KB |
testcase_19 | AC | 1,414 ms
82,544 KB |
testcase_20 | AC | 2 ms
4,376 KB |
testcase_21 | AC | 2 ms
4,376 KB |
testcase_22 | AC | 1,400 ms
82,604 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | AC | 2 ms
4,380 KB |
testcase_27 | AC | 2 ms
4,376 KB |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
ソースコード
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; const int INF=1e9,MOD=1e9+7,ohara=1e6+10; const ll LINF=1e18; using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define rrep(i,a,b) for(int i=(a);i<(b);i++) #define rrrep(i,a,b) for(int i=(a);i>=(b);i--) #define all(v) (v).begin(), (v).end() #define Size(n) (n).size() #define Cout(x) cout<<(x)<<endl #define Cerr(x) cerr<<(x)<<endl #define fi first #define se second #define P pair<ll,ll> #define m_p make_pair #define V vector<ll> ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos; ld doua; int dy[]={1,0,-1,0}; int dx[]={0,1,0,-1}; //int dy[]={-1,0,1,-1,1,-1,0,1}; //int dx[]={-1,-1,-1,0,0,1,1,1}; string alph("abcdefghijklmnopqrstuvwxyz"),s; bool fl; struct edge{int to,cost;}; unordered_map<ll,ll> mp; //-------------------------↓↓↓↓↓↓------------------------ int main(void){ cin.tie(0); ios::sync_with_stdio(false); cin>>n>>d; rrep(i,1,n+1){ rrep(j,1,n+1){ mp[i*i-j*j]++; } } rrep(i,1,n+1){ rrep(j,1,n+1){ tmp=i*i+j*j-d; ans+=mp[tmp]; } } Cout(ans); return 0; }