結果

問題 No.1514 Squared Matching
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-06-18 22:06:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 772 bytes
コンパイル時間 2,487 ms
コンパイル使用メモリ 203,844 KB
実行使用メモリ 784,684 KB
最終ジャッジ日時 2023-09-08 15:57:12
合計ジャッジ時間 58,323 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 MLE -
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 30 ms
15,008 KB
testcase_07 AC 512 ms
152,092 KB
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 550 ms
159,448 KB
testcase_23 AC 1,115 ms
315,588 KB
testcase_24 AC 1,770 ms
471,712 KB
testcase_25 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<ll> prime, odd;

void erat(long long N){
    prime.resize(N+1, 1);
    prime[0] = 0;
    prime[1] = 0;
    odd.resize(N+1);
    for (int i=0; i<=N; i++) odd[i] = i;
    for (long long i=2; i*i<=N; i++){
        if (prime[i]){
            for (long long j=i*2; j <= N; j+=i){
                prime[j] = 0;
            }
            ll q=1;
            while(i*i<=N/q){
                q*=i*i;
                for (ll j=q; j<=N; j+=q){
                    odd[j] /= (i*i);
                }
            }
        }
    }
}

int main(){

    ll N, ans=0;
    cin >> N;
    erat(N);
    for (ll i=1; i<=N; i++){
        ans += floor(sqrt(N/odd[i]));
    }

    cout << ans << endl;

    return 0;
}
0