結果

問題 No.1653 Squarefree
ユーザー HaaHaa
提出日時 2021-08-20 22:32:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 911 bytes
コンパイル時間 1,621 ms
コンパイル使用メモリ 164,860 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-22 05:20:00
合計ジャッジ時間 7,911 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 13 ms
5,248 KB
testcase_02 WA -
testcase_03 AC 14 ms
5,376 KB
testcase_04 AC 13 ms
5,376 KB
testcase_05 AC 13 ms
5,376 KB
testcase_06 AC 13 ms
5,376 KB
testcase_07 AC 13 ms
5,376 KB
testcase_08 AC 13 ms
5,376 KB
testcase_09 AC 14 ms
5,376 KB
testcase_10 AC 13 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 13 ms
5,376 KB
testcase_37 AC 12 ms
5,376 KB
testcase_38 AC 13 ms
5,376 KB
testcase_39 AC 13 ms
5,376 KB
testcase_40 AC 13 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

int main() {
    ll l, r; cin >> l >> r;
    VI f(r-l+1,0);
    ll rt; bool b;
    for(ll i=1;i<=1000000;i++){
        ll s=((l-1)/i+1)*i;
        rt=sqrt(i);
        b=0;
        if(rt*rt==i&&i!=1)
            b=1;
        for(ll j=s;j<=r;j+=i){
            rt=sqrt(j/i);
            if((rt!=1&&rt*rt==j/i)||b)
                f[j-l]=1;
        }
    }
    int ans=0;
    if(l==1) ans++;
    for(ll i=l;i<=r;i++)
        ans+=!f[i-l];
    cout << ans << endl;
    return 0;
}
0