Submission #512627

# Submission time Handle Problem Language Result Execution time Memory
512627 2022-01-16T14:34:04 Z Jean7 Savrsen (COCI17_savrsen) C++14
120 / 120
1175 ms 78552 KB
#include <bits/stdc++.h>
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define int long long

using namespace std ;

int abso ( int x ) {
    return ( x > 0 ? x : -x ) ;
}

vector <int> v ;

signed main ()
{
    fio ;
    int a , b , ans = 0 ;
    cin >> a >> b ;
    v.resize(b+1) ;
    for ( int i = 1 ; i <= b ; i++ ) {
        for ( int j = 2*i ; j <= b ; j += i ) {
            v[j] += i ;
        }
    }
    while ( a <= b )
    {
        ans += abso ( a - v[a] ) ;
        a++ ;
    }
    cout << ans ;
    return 0 ;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 1080 KB Output is correct
4 Correct 1090 ms 78552 KB Output is correct
5 Correct 1175 ms 78536 KB Output is correct
6 Correct 1122 ms 78476 KB Output is correct
7 Correct 962 ms 72400 KB Output is correct
8 Correct 210 ms 20176 KB Output is correct