Submission #884436

# Submission time Handle Problem Language Result Execution time Memory
884436 2023-12-07T10:50:54 Z ElenaBM Savrsen (COCI17_savrsen) C++17
60 / 120
3000 ms 600 KB
#include <bits/stdc++.h>
#define int long long 

using namespace std;

int f (int n){
    int ans = 1;
    if (n == 1) return 0;
    for (int i = 2; i <= sqrt(n); ++i){
        if (i*i == n) ans += i;
        else if (n%i == 0) ans += i + n/i;
    }
    return ans;
}
signed main()
{
    int a, b;
    cin>> a >> b;
    int ans = 0;
    for (int i = a; i <= b; ++i){
        ans += abs(i- f(i));
    }
    cout<< ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 122 ms 600 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Execution timed out 3013 ms 344 KB Time limit exceeded
6 Execution timed out 3055 ms 348 KB Time limit exceeded
7 Execution timed out 3065 ms 348 KB Time limit exceeded
8 Execution timed out 3040 ms 344 KB Time limit exceeded