Submission #1039369

# Submission time Handle Problem Language Result Execution time Memory
1039369 2024-07-30T19:16:24 Z 7again Savrsen (COCI17_savrsen) C++17
30 / 120
459 ms 39516 KB
#include <bits/stdc++.h>
#define FAST ios::sync_with_stdio(0);cout.tie(0);cin.tie(0)

using namespace std ;

void slv()
{
    int l , r ;
    cin >> l >> r ;

    vector <int> sum(1e7+1 , 0) ;
    for(int i = 2 ; i <= 1e7 ; i++)
    {
        for(int j = 2*i ; j <= 1e7 ; j += i)
            sum[j] += i ;
    }


    sum[1] = 1 ;
    for(int i = 2 ; i <= 1e7 ; i++)
    {
        sum[i] = abs(i - (sum[i] + 1)) ;
        sum[i] += sum[i - 1] ;
    }

    cout << sum[r] - sum[l - 1] ;
}
main()
{

    FAST ;

    slv() ;
}

Compilation message

savrsen.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 440 ms 39516 KB Output is correct
2 Correct 419 ms 39516 KB Output is correct
3 Incorrect 438 ms 39512 KB Output isn't correct
4 Incorrect 459 ms 39364 KB Output isn't correct
5 Incorrect 453 ms 39512 KB Output isn't correct
6 Incorrect 445 ms 39516 KB Output isn't correct
7 Incorrect 445 ms 39516 KB Output isn't correct
8 Incorrect 455 ms 39516 KB Output isn't correct