Submission #856103

# Submission time Handle Problem Language Result Execution time Memory
856103 2023-10-02T16:41:30 Z vjudge1 Savrsen (COCI17_savrsen) C++17
30 / 120
635 ms 78684 KB
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

const int MAXN = 1E7 + 5;

int res[MAXN];
int pref[MAXN];

void precalc() {
    for(int i = 1; i < MAXN; i++) {
        for(int j = i; j < MAXN; j += i) {
            res[j] += i;
        }

        pref[i] = abs(res[i] - 2 * i);
    }

    for(int i = 1; i < MAXN; i++)
        pref[i] += pref[i -1];
}

#define ONLINE_JUDGE
void solve() {
    int a, b;
    cin >> a >> b;

    cout << pref[b] - pref[a -1];
    
    return;
}

signed main() {
    #ifndef ONLINE_JUDGE
        freopen(".in", "r", stdin);
        freopen(".out", "w", stdout);
    #endif

    precalc();

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 582 ms 78676 KB Output is correct
2 Correct 589 ms 78684 KB Output is correct
3 Incorrect 590 ms 78676 KB Output isn't correct
4 Incorrect 580 ms 78612 KB Output isn't correct
5 Incorrect 632 ms 78616 KB Output isn't correct
6 Incorrect 630 ms 78488 KB Output isn't correct
7 Incorrect 635 ms 78676 KB Output isn't correct
8 Incorrect 596 ms 78620 KB Output isn't correct