# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
318468 | ignaciocanta | Savrsen (COCI17_savrsen) | C++14 | 1296 ms | 39652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using tint = long long;
using ld = long double;
#define forsn(i, s, n) for(int i = s; i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
#define DBG(x) cerr << #x << " = " << x << endl;
const int MOD = 1e9+7;
const int MX = 1e5+5;
const tint INF = 1e18;
const int inf = 2e9;
const ld PI = acos(ld(-1));
void NACHO(string name = "moop"){
ios_base::sync_with_stdio(0); cin.tie(0);
//freopen((name+".in").c_str(), "r", stdin);
//freopen((name+".out").c_str(), "w", stdout);
}
struct pt{
int x, y;
bool operator<(const pt &o)const{
if(x == o.x) return y < o.y;
return x < o.x;
}
};
int main(){
NACHO();
int a, b;
cin >> a >> b;
vi sum (b+1, 0);
forsn(i, 1, b+1){
for(int j = i+i; j <= b; j+=i){
sum[j]+=i;
}
}
int tot = 0;
forsn(i, a, b+1){
tot+=abs(i-sum[i]);
}
cout << tot << endl;
//pensa que si vas por todas las rectas horizontales de arriba p abajo,
//podes considerar a todos los puntos en se recta con los puntos en los extremos.
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |