結果

問題 No.1653 Squarefree
ユーザー ktr216ktr216
提出日時 2021-08-20 23:04:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 852 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 169,912 KB
実行使用メモリ 50,560 KB
最終ジャッジ日時 2024-04-22 09:21:12
合計ジャッジ時間 26,019 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 827 ms
50,432 KB
testcase_01 AC 33 ms
5,376 KB
testcase_02 AC 31 ms
5,376 KB
testcase_03 AC 38 ms
5,376 KB
testcase_04 AC 34 ms
5,376 KB
testcase_05 AC 34 ms
5,376 KB
testcase_06 AC 33 ms
5,376 KB
testcase_07 AC 33 ms
5,376 KB
testcase_08 AC 35 ms
5,376 KB
testcase_09 AC 35 ms
5,376 KB
testcase_10 AC 32 ms
5,376 KB
testcase_11 AC 734 ms
50,304 KB
testcase_12 AC 728 ms
50,304 KB
testcase_13 AC 830 ms
50,176 KB
testcase_14 AC 840 ms
50,176 KB
testcase_15 AC 852 ms
50,432 KB
testcase_16 AC 838 ms
50,176 KB
testcase_17 AC 843 ms
50,432 KB
testcase_18 AC 829 ms
50,432 KB
testcase_19 AC 798 ms
50,048 KB
testcase_20 AC 819 ms
50,560 KB
testcase_21 AC 814 ms
50,560 KB
testcase_22 AC 825 ms
50,432 KB
testcase_23 AC 794 ms
50,048 KB
testcase_24 AC 843 ms
50,176 KB
testcase_25 AC 835 ms
50,560 KB
testcase_26 AC 825 ms
50,048 KB
testcase_27 AC 823 ms
50,304 KB
testcase_28 AC 828 ms
50,048 KB
testcase_29 AC 850 ms
50,304 KB
testcase_30 AC 823 ms
50,048 KB
testcase_31 AC 843 ms
50,304 KB
testcase_32 AC 811 ms
50,304 KB
testcase_33 AC 842 ms
50,048 KB
testcase_34 AC 839 ms
50,304 KB
testcase_35 AC 839 ms
50,304 KB
testcase_36 AC 39 ms
5,376 KB
testcase_37 AC 40 ms
5,376 KB
testcase_38 AC 39 ms
5,376 KB
testcase_39 AC 41 ms
5,376 KB
testcase_40 AC 39 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;

typedef long long ll;

int main() {
    ll L, R;
    cin >> L >> R;
    set<ll> st;
    rep(i, 0, R - L + 1) st.insert(i + L);
    rep(i, 2, 1e6) {
        ll x = 1LL * i * i;
        for (ll j = max(L / x * x, x); j <= R; j += x) {
            //cout << j << endl;
            st.erase(j);
            //for (auto k : st) cout << k << " "; cout << endl;
        }
    }
    rep(i, 1, 1e6) {
        ll x = sqrt(R / i);
        if (x == 1) continue;
        st.erase(x * x * i);
    }
    cout << st.size() << endl;
}
0