제출 #109145

#제출 시각아이디문제언어결과실행 시간메모리
109145bibabasSavrsen (COCI17_savrsen)C++14
90 / 120
1949 ms39672 KiB
#ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #define ll long long #define vi vector<int> #define vvi vector<vi> #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair int INF = (int)2e9; using namespace std; template <class T> istream& operator >>(istream &in, vector<T> &arr) { for (T &cnt : arr) { in >> cnt; } return in; }; int sum[(int)1e7 + 1]; void solve() { sum[1] = 1; int a, b; cin >> a >> b; ll ans = 0; for (int i = 1; i <= (int)1e7; ++i){ if (a <= i && i <= b) ans += abs(sum[i] - i); for (int j = 2 * i; j <= (int)1e7; j += i){ sum[j] += i; } } cout << ans; } int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #endif solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...