結果

問題 No.800 四平方定理
ユーザー edamame882edamame882
提出日時 2019-08-03 22:53:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,076 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 171,056 KB
実行使用メモリ 109,484 KB
最終ジャッジ日時 2023-09-20 17:01:27
合計ジャッジ時間 6,986 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
5,352 KB
testcase_01 AC 32 ms
7,316 KB
testcase_02 AC 21 ms
5,956 KB
testcase_03 AC 24 ms
6,660 KB
testcase_04 AC 20 ms
5,852 KB
testcase_05 AC 24 ms
6,480 KB
testcase_06 AC 38 ms
8,080 KB
testcase_07 AC 28 ms
6,964 KB
testcase_08 AC 37 ms
8,232 KB
testcase_09 AC 32 ms
7,372 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll 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);
  ll n,d;
  cin >> n >> d;
  map<ll,ll> mp;
  ll 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