Submission #1085828

# Submission time Handle Problem Language Result Execution time Memory
1085828 2024-09-08T19:29:45 Z andrewp Savrsen (COCI17_savrsen) C++14
30 / 120
455 ms 39576 KB
//Dedicated to my love, ivaziva
#include <bits/stdc++.h>
using namespace std;   

using pii = pair<int, int>;
using ll = int64_t;    

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define dbg(x) cerr << #x << ": " << x << '\n';    

int sum[10000005];

int32_t main() { 
    ios::sync_with_stdio(false); cin.tie(nullptr);
    cout.tie(nullptr); cerr.tie(nullptr); 

    int a, b;
    cin >> a >> b;
    for (int i = 2; i < 10000001; i++) {
        for (int j = i + i; j < 10000001; j += i) {
            sum[j] += i;
        }
    }   
    int ans = 0; 
    for (int i = a; i <= b; i++) {
        if (i == 1) {
            ans += abs(i - sum[i]);
        } else {
            ans += abs(i - sum[i] - 1);
        }
    }
    cout << ans << '\n';
    return 0;                  
}
# Verdict Execution time Memory Grader output
1 Correct 423 ms 39572 KB Output is correct
2 Correct 436 ms 39512 KB Output is correct
3 Incorrect 429 ms 39512 KB Output isn't correct
4 Incorrect 423 ms 39568 KB Output isn't correct
5 Incorrect 455 ms 39516 KB Output isn't correct
6 Incorrect 437 ms 39512 KB Output isn't correct
7 Incorrect 437 ms 39576 KB Output isn't correct
8 Incorrect 431 ms 39516 KB Output isn't correct