結果
| 問題 |
No.1653 Squarefree
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-20 23:04:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 844 ms / 2,000 ms |
| コード長 | 617 bytes |
| コンパイル時間 | 1,713 ms |
| コンパイル使用メモリ | 173,860 KB |
| 実行使用メモリ | 50,432 KB |
| 最終ジャッジ日時 | 2024-10-14 08:34:37 |
| 合計ジャッジ時間 | 25,217 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#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;
}