結果

問題 No.800 四平方定理
ユーザー edamame882edamame882
提出日時 2019-08-03 22:55:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,083 bytes
コンパイル時間 2,613 ms
コンパイル使用メモリ 172,012 KB
実行使用メモリ 83,788 KB
最終ジャッジ日時 2023-09-20 17:02:53
合計ジャッジ時間 9,746 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
4,980 KB
testcase_01 AC 29 ms
6,268 KB
testcase_02 AC 19 ms
5,316 KB
testcase_03 AC 23 ms
5,748 KB
testcase_04 AC 19 ms
5,364 KB
testcase_05 AC 21 ms
5,708 KB
testcase_06 AC 35 ms
6,952 KB
testcase_07 AC 26 ms
6,232 KB
testcase_08 AC 35 ms
7,084 KB
testcase_09 AC 30 ms
6,344 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,d;
  cin >> n >> d;
  map<int ,int> mp;
  int  ans = 0;
  FOR(a,1,n+1) FOR(b,1,n+1) mp[a*a + b*b] ++;
  FOR(w,1,n+1) FOR(c,1,n+1) ans += mp[d + w*w - c*c];
  cout << ans << endl;
  return 0;
}
0