Submission #151314

# Submission time Handle Problem Language Result Execution time Memory
151314 2019-09-02T12:40:34 Z Linca_Robert Savrsen (COCI17_savrsen) C++14
120 / 120
1450 ms 39500 KB
#include<bits/stdc++.h>
using namespace std;

const int DIM = 1e7 + 5;
int A, B, f[DIM];
long long ans = 0;
int main(){
    cin >> A >> B;
    for( int i = 1; i <= B; i++ ){
        f[i] -= i;
        for( int j = i + i; j <= B; j += i )
            f[j] += i;
    }
    for( int i = A; i <= B; i++ )
        ans += max( f[i], -f[i] );
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 5 ms 760 KB Output is correct
4 Correct 1438 ms 39496 KB Output is correct
5 Correct 1450 ms 39500 KB Output is correct
6 Correct 1384 ms 39496 KB Output is correct
7 Correct 1213 ms 36472 KB Output is correct
8 Correct 145 ms 10360 KB Output is correct