結果

問題 No.1593 Perfect Distance
ユーザー TsukumowanTsukumowan
提出日時 2021-07-10 13:39:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 2,169 ms
コンパイル使用メモリ 204,720 KB
実行使用メモリ 19,716 KB
最終ジャッジ日時 2023-09-14 19:01:06
合計ジャッジ時間 5,438 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
19,408 KB
testcase_01 AC 106 ms
19,396 KB
testcase_02 AC 97 ms
19,340 KB
testcase_03 AC 93 ms
19,324 KB
testcase_04 AC 97 ms
19,348 KB
testcase_05 AC 103 ms
19,264 KB
testcase_06 AC 109 ms
19,460 KB
testcase_07 AC 102 ms
19,408 KB
testcase_08 AC 105 ms
19,460 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 105 ms
19,412 KB
testcase_18 AC 99 ms
19,460 KB
testcase_19 AC 100 ms
19,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(){
    int64_t n;
    cin >> n;
    vector<int64_t> v(300000,1);
    set<int64_t> s;
    for(int i = 1;i < 300000;i++){
         v[i] = i * i;
         s.insert(v[i]);
    }
    int64_t root = n * n;
    int ans = 0;
    for(int i = 1;i < 300000;i++){
        if(v[i] >= root) break;
        if(s.find(root - v[i]) != s.end()){
            ans++;
        }
    }
    cout << ans << endl;
}
0