Submission #371031

# Submission time Handle Problem Language Result Execution time Memory
371031 2021-02-25T16:00:32 Z FatihSolak Savrsen (COCI17_savrsen) C++17
0 / 120
1353 ms 39660 KB
#include <bits/stdc++.h>
#define N 10000005
using namespace std;
int arr[N];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	int a,b;
	cin >> a >> b;
	long long sum = 0;
	for(int i=1;i<N;i++){
		for(int j=i+i;j<N;j+=i){
			arr[j] -= i;
		}
		arr[i]+=i;
	}
	for(int i=a;i<=b;i++){
		sum += abs(arr[i]);
	}
	cout << sum;
}

Compilation message

savrsen.cpp: In function 'int main()':
savrsen.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    8 |  freopen("in.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
savrsen.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  freopen("out.txt","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1353 ms 39532 KB Output isn't correct
2 Incorrect 1307 ms 39532 KB Output isn't correct
3 Incorrect 1317 ms 39660 KB Output isn't correct
4 Incorrect 1333 ms 39600 KB Output isn't correct
5 Incorrect 1299 ms 39660 KB Output isn't correct
6 Incorrect 1307 ms 39532 KB Output isn't correct
7 Incorrect 1320 ms 39632 KB Output isn't correct
8 Incorrect 1323 ms 39532 KB Output isn't correct