Submission #740479

#TimeUsernameProblemLanguageResultExecution timeMemory
740479mzvSavrsen (COCI17_savrsen)C++17
120 / 120
1124 ms78592 KiB
#include <bits/stdc++.h> #define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long #define endl '\n' using namespace std; /* ------------------------ hi lol ------------------------ */ // author : mzv ll l,r,ans=0; vector<ll> sieve(10000001,0); int main() { ccd cin >> l >> r; for (int i=1;i<=r;i++) { ll ks=i; while (ks+i<=r) { sieve[ks+i]+=i; ks+=i; } } for (int i=l;i<=r;i++) { ans+=abs(i-sieve[i]); } cout << ans << endl; } // gamungkin menggunakan teknik hitung manual karena bakal lama // pake teknik sieve keknya karena cmn sieve yg cepet ngeluarin hsl pembagian utk size gede
#Verdict Execution timeMemoryGrader output
Fetching results...