# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
466951 | 2021-08-21T03:56:20 Z | XBoRickie | Savrsen (COCI17_savrsen) | C++11 | 1336 ms | 39408 KB |
#include "bits/stdc++.h" #define MAXN 10000009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<<endl; #define ppb() pop_back() #define tr(ii,c) for(typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++) #define ff first #define ss second using namespace std; typedef long long ll; typedef pair<int,int> PII; template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} int d[MAXN]; int main(){ int a,b; ll ans=0; scanf("%d%d",&a,&b); ans+=(a==1); for(int i=2;i<=b;i++){ d[i]+=i-1; if(i>=a) ans+=abs(d[i]); for(int j=i+i;j<=b;j+=i) d[j]-=i; } printf("%lld\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 4 ms | 616 KB | Output is correct |
4 | Correct | 1286 ms | 39404 KB | Output is correct |
5 | Correct | 1336 ms | 39404 KB | Output is correct |
6 | Correct | 1330 ms | 39408 KB | Output is correct |
7 | Correct | 1174 ms | 36344 KB | Output is correct |
8 | Correct | 230 ms | 10188 KB | Output is correct |