Submission #482192

# Submission time Handle Problem Language Result Execution time Memory
482192 2021-10-23T15:19:12 Z MilosMilutinovic Savrsen (COCI17_savrsen) C++14
30 / 120
1014 ms 39492 KB
#include <bits/stdc++.h>
#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define pb push_back

using namespace std;

int sum[10000005];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	ff(i,1,1e7){
	   for(int j = i + i; j <= 1e7; j += i)sum[j] += i;
	}
	int a, b;
	cin >> a >> b;
	int ans = 0;
	ff(i,a,b)ans += abs(i-sum[i]);
	cout << ans;
	return 0;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:2:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    2 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
savrsen.cpp:15:2: note: in expansion of macro 'ff'
   15 |  ff(i,1,1e7){
      |  ^~
savrsen.cpp:2:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    2 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
savrsen.cpp:21:2: note: in expansion of macro 'ff'
   21 |  ff(i,a,b)ans += abs(i-sum[i]);
      |  ^~
# Verdict Execution time Memory Grader output
1 Correct 945 ms 39492 KB Output is correct
2 Correct 935 ms 39424 KB Output is correct
3 Incorrect 926 ms 39428 KB Output isn't correct
4 Incorrect 984 ms 39428 KB Output isn't correct
5 Incorrect 957 ms 39424 KB Output isn't correct
6 Incorrect 1014 ms 39444 KB Output isn't correct
7 Incorrect 966 ms 39424 KB Output isn't correct
8 Incorrect 984 ms 39424 KB Output isn't correct