답안 #856103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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