# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740479 | mzv | Savrsen (COCI17_savrsen) | C++17 | 1124 ms | 78592 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
/* ------------------------ hi lol ------------------------ */
// author : mzv
ll l,r,ans=0;
vector<ll> sieve(10000001,0);
int main() {
ccd
cin >> l >> r;
for (int i=1;i<=r;i++) {
ll ks=i;
while (ks+i<=r) {
sieve[ks+i]+=i;
ks+=i;
}
}
for (int i=l;i<=r;i++) {
ans+=abs(i-sieve[i]);
}
cout << ans << endl;
}
// gamungkin menggunakan teknik hitung manual karena bakal lama
// pake teknik sieve keknya karena cmn sieve yg cepet ngeluarin hsl pembagian utk size gede
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |