結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
null_mn
|
| 提出日時 | 2019-03-20 20:30:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 579 bytes |
| コンパイル時間 | 1,457 ms |
| コンパイル使用メモリ | 173,124 KB |
| 実行使用メモリ | 111,564 KB |
| 最終ジャッジ日時 | 2024-09-19 00:49:23 |
| 合計ジャッジ時間 | 5,491 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 10 TLE * 11 -- * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main() {
ll n, d;
cin >> n >> d;
vector<ll> A;
multiset<ll> B; //A(:=xx+yy),B(:=ww-zz+D)の取り得る値を列挙
for (ll x = 1; x <= n; ++x) {
for (ll y = 1; y <= n; ++y) {
A.push_back(x * x + y * y);
}
}
for (ll x = 1; x <= n; ++x) {
for (ll y = 1; y <= n; ++y) {
B.insert(x * x - y * y + d);
}
}
int cnt = 0;
for (auto a : A) {
cnt += B.count(a);
}
cout << cnt << endl;
return 0;
}
null_mn