Submission #974587

# Submission time Handle Problem Language Result Execution time Memory
974587 2024-05-03T13:33:45 Z vjudge1 Savrsen (COCI17_savrsen) C++17
120 / 120
776 ms 39764 KB
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define sz(x) (ll)x.size()
using namespace std;
int tt[10000005]{0};
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a,b;cin>>a>>b;
    for(int i=1;i<=b;i++){
        for(int j=2*i;j<=b;j+=i)tt[j]+=i;
    }ll ans=0;
    for(int i=a;i<=b;i++)ans+=abs(i-tt[i]);
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 776 ms 39568 KB Output is correct
5 Correct 744 ms 39764 KB Output is correct
6 Correct 764 ms 39576 KB Output is correct
7 Correct 648 ms 37560 KB Output is correct
8 Correct 64 ms 10884 KB Output is correct