QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#129205 | #6740. Function | Nicolas125841 | ML | 0ms | 0kb | C++17 | 933b | 2023-07-22 06:27:37 | 2023-07-22 06:27:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const int N = 20210926;
const int SB = 32;
vector<ll> dp(N+1);
vector<unordered_set<int>> sets(N+1, unordered_set<int>());
vector<int> lp(N+1), pr;
void prep(){
for (int i=2; i <= N; ++i) {
if (lp[i] == 0) {
lp[i] = i;
sets[i].insert(i);
pr.push_back(i);
}
for(int v : sets[i/lp[i]]){
sets[i].insert(v);
sets[i].insert(v*lp[i]);
}
for (int j = 0; i * pr[j] <= N; ++j) {
lp[i * pr[j]] = pr[j];
if (pr[j] == lp[i]) {
break;
}
}
}
}
int main(){
prep();
int n;
cin >> n;
ll ans = 0;
//for(int i = 1; i <= n; i++){
// ans += pref[i] - pref[i-1];
//}
cout << ans << "\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Memory Limit Exceeded
input:
1