結果

問題 No.1593 Perfect Distance
ユーザー h2929
提出日時 2021-07-09 21:38:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 3,988 ms
コンパイル使用メモリ 235,620 KB
実行使用メモリ 28,416 KB
最終ジャッジ日時 2024-07-01 15:31:09
合計ジャッジ時間 4,888 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define ll long long int
#define INF 1000000000000000000
using namespace atcoder;
using namespace std;

int main(void){
  ll n;
  cin >> n;
  map<ll, ll> mp;

  for (ll i = 1; i < n; i++){
    mp[i*i]++;
  }

  ll ans = 0;
  for (ll i = 1; i < n; i++){
    ans += mp[n*n - i*i];
  }
  cout << ans << endl;



  return 0;
}
0