# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1105996 | 2024-10-28T16:35:23 Z | dzhoz0 | Savrsen (COCI17_savrsen) | C++17 | 303 ms | 78840 KB |
/* ghmt the cutie :3 UwU */ #include <bits/stdc++.h> using namespace std; #define int long long #define INF 1e18 #define f first #define s second #define pii pair<int, int> #define vi vector<int> const int MOD = 1'000'000'000 + 7; void setIO(string name = "") { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #ifdef LOCAL freopen("inp.txt", "r", stdin); freopen("out.txt", "w", stdout); #else if (!name.empty()) { freopen((name + ".INP").c_str(), "r", stdin); freopen((name + ".OUT").c_str(), "w", stdout); } #endif } const int MAXN = 1e7; int sumFactor[MAXN + 5]; void init() { memset(sumFactor, 0, sizeof(sumFactor)); for (int p = 1; p * p <= MAXN; p++) { sumFactor[p * p] += p; for (int q = p + 1; p * q <= MAXN; q++) sumFactor[p * q] += p + q; } } void solve() { init(); int l, r; cin >> l >> r; int res = 0; for(int x = l; x <= r; x++) { res += abs(2 * x - sumFactor[x]); } cout << res << '\n'; } signed main() { setIO(); int t = 1; // cin >> t; while (t--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 277 ms | 78672 KB | Output is correct |
2 | Correct | 281 ms | 78840 KB | Output is correct |
3 | Correct | 285 ms | 78716 KB | Output is correct |
4 | Correct | 275 ms | 78672 KB | Output is correct |
5 | Correct | 291 ms | 78672 KB | Output is correct |
6 | Correct | 303 ms | 78672 KB | Output is correct |
7 | Correct | 292 ms | 78672 KB | Output is correct |
8 | Correct | 284 ms | 78684 KB | Output is correct |