Submission #173668

# Submission time Handle Problem Language Result Execution time Memory
173668 2020-01-04T22:52:32 Z MladenP Savrsen (COCI17_savrsen) C++17
0 / 120
2 ms 376 KB
#include<bits/stdc++.h>
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
#define NL(x) " \n"[(x)]
#define lld long long
#define pil pair<int,lld>
#define pli pair<lld,int>
#define pll pair<lld,lld>
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mid (l+r)/2
#define endl '\n'
#define all(a) begin(a),end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
lld d[10000010];

int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0);
    int A, B;
    lld rez = 0;
    for(int i = 1; i <= B; i++) {
        for(int j = 2*i; j <= B; j+=i) d[j] -= i;
        if(i >= A) rez += abs(i+d[i]);
    }
    cout << rez;
    return 0;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:26:22: warning: 'B' is used uninitialized in this function [-Wuninitialized]
     for(int i = 1; i <= B; i++) {
                    ~~^~~~
savrsen.cpp:28:9: warning: 'A' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if(i >= A) rez += abs(i+d[i]);
         ^~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 252 KB Output isn't correct