結果
問題 | No.1593 Perfect Distance |
ユーザー | KKT89 |
提出日時 | 2021-08-03 05:54:18 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 126 ms / 2,000 ms |
コード長 | 724 bytes |
コンパイル時間 | 2,691 ms |
コンパイル使用メモリ | 215,580 KB |
実行使用メモリ | 28,272 KB |
最終ジャッジ日時 | 2023-10-14 21:05:08 |
合計ジャッジ時間 | 4,284 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,356 KB |
testcase_02 | AC | 2 ms
4,352 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,352 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 1 ms
4,352 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,352 KB |
testcase_09 | AC | 5 ms
4,408 KB |
testcase_10 | AC | 16 ms
6,760 KB |
testcase_11 | AC | 26 ms
8,848 KB |
testcase_12 | AC | 45 ms
12,996 KB |
testcase_13 | AC | 48 ms
13,400 KB |
testcase_14 | AC | 56 ms
15,328 KB |
testcase_15 | AC | 84 ms
20,604 KB |
testcase_16 | AC | 126 ms
28,272 KB |
testcase_17 | AC | 2 ms
4,348 KB |
testcase_18 | AC | 1 ms
4,352 KB |
testcase_19 | AC | 1 ms
4,352 KB |
ソースコード
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } constexpr ll mod=1e9+7; ll mod_pow(ll a,ll b,ll mod){ a%=mod; if(b==0)return 1; if(b==1)return a; ll res=mod_pow(a,b/2,mod)%mod; res*=res; res%=mod; if(b%2)res*=a; return res%mod; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n; cin >> n; map<ll,int> mp; int res=0; for(ll i=1;i<=n;i++){ mp[i*i]++; } for(ll x=1;x<=n;x++){ res+=mp[n*n-x*x]; } cout << res << endl; }